In this post, we will be seeing how we can run xpath or css queries on chrome browser
Steps :
- Open Chrome browser, navigate to required URL (say google.co.in)
- KeyPress
F12
(opens chrome developer tool) - Make sure we are at Elements tab, key press
CTRL
+F
- Search box appears, then enter any of the below commands to verify
Xpath – //*[text()='India']
CSS – .logo-subtext
Note: if xpath exist, respective element on DOM will be highlighted with yellow color.
Another way to use Console tab to verify both xpath and css , let’s see how
Steps :
- Open Chrome browser, navigate to url (say
google.co.in
) - Keypress
F12
- Click on
Console
tab - type any one of the below command and press enter
For xpath – $x("//*[text()='India']")
For CSS – $$(".logo-subtext")
Note: if query verified, click on the result displayed and it will highlight the element on DOM.