March 04, 2023

SelectorsHub Advanced Tutorial - Dynamic Elements XPath Selectorshub | Generate Multiple Locators and Automation Testing Code

This is the third SelectorsHub tutorial in my SelectorsHub free full course. I explain how to get XPath or CSS selectors for dynamic or difficult web elements and generate multiple XPath and automation testing code. Learn how to use SelectorsHub to find the correct and unique locators for dynamic or difficult web elements by viewing SelectorsHub advanced tutorial below or read on...

SelectorsHub debugger: SelectorsHub has a debugger feature. It is useful when the web element that you are trying to inspect becomes invisible on inspecting. If so, how to find XPath in Selenium WebDriver or other tools for such a web element? You can turn on the debugger in SelectorsHub which stops the web page after 5 Seconds. So, you have 5 seconds in which you need to make that web element visible. I show how this works to get CSS selectors or XPath in Selenium Webdriver or other tools in the above video. I  try to inspect a web element on a website so I right click on it but as soon as I right-click, it disappears. You can find a similar situation on other websites. The solution is that I can use the SelectorsHub debugger feature. In SelectorsHub, there is an icon which says Turn on Debugger. After turning on the debugger, I have 5 seconds to make that web element visible. After 5 seconds, SelectorsHub pauses the web page and I can inspect the web element as usual.

It is possible that the web element disappears within the 5 seconds debugger time. Still, I can use the SelectorsHub tool to find the XPath or CSS selector in Selenium Webdriver or other tools. What I need to do is just click on the icon whose tooltip is Click to customize UI. There I get Debugger start time and I can change it to zero. After changing it to zero, go back to the home screen of SelectorsHub and try again (make the element visible and turn on debugger). This time the debugger should start immediately, pausing the web page. Then I can use SelectorsHub to inspect that element successfully.

Multiple locators: In test automation you don't need just one but different locators in Selenium Webdriver or other tools. In SelectorsHub, I can click the icon whose tooltip says Click to generate automation code or multiple selectors. Then inspect the web elements one by one then I can copy all the XPaths or CSS selectors or if I had set the driver command earlier (read next paragraph), I can even copy the automation testing code or even page object model code. I show this process in the above video to get multiple locators on this blog, Software Testing Space.

Automation testing code: I can not only get multiple selectors like XPath or CSS selectors but I can get the complete command and for that I need click on the icon whose tooltip says Set driver command to append on selectors. Then click on the icon to generate automation code or multiple selectors. You can view the example in the above video.

Verify XPaths: In SelectorsHub usage, you should know about SelectorsHub smart maintenance. I can verify multiple XPaths or I can even verify the complete script by pasting it and giving the XPath command. Again, you can see the example of smart maintenance in the above video.

In conclusion, SelectorsHub is a useful tool for automation testing engineers and web developers to enhance their productivity and efficiency by finding the correct and unique locators for dynamic or difficult web elements and generating multiple XPath and automation testing code. Thank you 🙏

Labels: Locators in selenium, Xpath in selenium webdriver, How to find xpath in selenium webdriver, CSS selector in selenium webdriver, SelectorsHub tutorial, XPath, Selectorshub free full course, Selectorshub tool, Locators in selenium webdriver, Selenium, Locators, Selenium webdriver, Xpath in selenium webdriver, Xpath in selenium, CSS selector, Webdriver, CSS selectors, Automation testing, Test automation

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.