Execute xpath or css on Chrome browser

In this post, we will be seeing how we can run xpath or css queries on chrome browser

Steps :

  1. Open Chrome browser, navigate to required URL (say google.co.in)
  2. KeyPress F12(opens chrome developer tool)
  3. Make sure we are at Elements tab, key press CTRL + F
  4. 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 :

  1. Open Chrome browser, navigate to url (say google.co.in)
  2. Keypress F12
  3. Click on Console tab
  4. 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.

Content posted is based on learning or working experience, please leave comments if anything needs to be added or updated, discuss your queries on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: