Sunday, 2 September 2018

How to validate constructed xpath or CSS selector in Mozilla firefox / Google chrome without using any plugin



Let us say, for application under test, you have constructed relative xpath / CSS to be used in Selenium code.

Now you want to test or validate in browser without using any plugin.
This can be achieved using developer tools of Mozilla firefox. By going to Console tab, type

$x("provide your xpath");

for eg: $x("//*[@id='lst-ib']") and press enter. If it was correct locator, you will get the element returned in the console, which will highlight when hover on the web page.

Similarly to test, CSS in Mozilla firefox use $$("provide your css selector");
$$("input[id='lst-ib']")





In the Chrome browser, to test xpath / CSS, simply go to developer tools, and use Control +F and paste your xpath / CSS. You will get element highlighted in Yellow color



Hope this blog has been useful to you. Do comment if you have any further questions.

No comments:

Post a Comment

How to schedule RFT (Rational Functional Tester) scripts to run using Jenkins / schedule

How to schedule RFT (Rational Functional Tester) scripts to run using Jenkins / schedule 1. Create a batch file with following content ...