7 Advanced SelectorsHub Tutorial For XPath And CSS Selector In Selenium WebDriver

Appsierra

Locators in selenium play a very essential role to define your selenium testing scripts. If you fail to specify selenium locators appropriately then the selenium automation script won't be able to locate elements on the graphical user interface of your web application.

CSS selector and XPath are two of the most essential ways for locating web elements for selenium test automation…..Learn more

7 Important features in the advanced SelectorsHub tutorial

Get the iframe and iframe element XPath together :

It is a very time taking process to get Xpath and iframe and then elements of the iframe. Also, it is very difficult to find that element is inside the iframe or on-page if the iframe is rendered inside the page. It will be easy to identify elements inside the iframe using the SelectorsHub Chrome extension. Let's see how you can do it:

  1. Open http://only-testing-blog.blogspot.com/2015/01/iframe1.html and you will find the iframe present on-page.
  2. Right-click on the check box present inside the iframe and inspect it and it will open devtool.
  3. Then go to selectors and have a subtab in the sidebar…..Learn more

You can also locate the nested iframe element and obtain XPath of both iframes using the advanced SelectorsHub tutorial.

Then you can copy it and use it in the selenium WebDriver automation test script.

Identify and locate Shadow Dom Elements for selenium WebDriver.

XPath is supported for Shadow Dom Elements as it is very difficult to locate these elements using other selectors as well. It is very troublesome to understand if it is a normal web element or Shadow Dom web element and a lot of time will be wasted in locating it.

Selecting advanced SelectorsHub tutorial chrome extension for Chrome identifies and tells if it is a Shadow Dom Element or not. Also, it provides scripts that are ready to use for such elements. Let's see how this works:

  1. Inspect Shadow Dom Element using Dev tool and open selectors have some tab from the sidebar.
  2. Here the element identifier says that it is a Shadow Dom Element.
  3. It will show an alert message that XPath is not supported for this element….Learn more

You may also like 20 Best Selenium Alternative for 2021

Get JS path of an element using SelectorsHub Chrome extension.

You can also get the JS path of any web element.

Generate Xpath or CSS selectors for SVG elements using SelectorsHub for Chrome.

You will struggle to generate XPath or CSS selector of SVG elements on-page. But advanced SelectorsHub tutorial will make it easy to identify the SVG element and generate its XPath or CSS selectors…..Learn more

Writing case-insensitive XPath and CSS selector.

You should write case-sensitive attributes in XPath and CSS selectors. If you write case insensitive attributes it will fail to locate the element on-page. SelectorsHub Chrome offers conversion facilities from case sensitive to case sensitive to XPath and CSS selectors.

For converting it:

  1. Inspect elements using SelectorsHub.
  2. Click to make the selector case insensitive icon.
  3. CssSelector is transformed to input from input[title='Search']. You may thus now find the element by using the input[title = 'SEARCH' I or cssSelector to the input [title = 'SEArch' I
  4. XPath transformed from the input /input[@title='Search'] to /input[translate(@title, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ']. So, you don't have to write a capital letter attribute now. It works with little letters….Continue reading
No publications here.