Wednesday, September 9, 2015

Selenium : Using FireFox and Chrome inbuilt Inspector and Xpath evaluator


Using FireFox inbuilt Inspector and Xpath evaluator

Steps below

  1. Launch Firefox (I'm using  40.0.3)
  2.  Open url "google.co.in"
  3. Goto Tools >Web Developer>Inspector
 

 Similar to Firebug , user can use crosshair in the console to target a particular element.

To Verify Xpath :
  1. In the above console
  2. Click on ">Console" tab
  3. type - $x("//input[@type='submit']")
  4. Press "Enter"
 


Syntax : $x("xpath")

For Chrome (same as Firefox)

Method 1:
Install Chropath extension for Chrome
Rt ck on web page
Ck on inspect 
In Developer window , click on ">>" symbol
Select chropath



Method 2 :
User can goto :
  • Settings>More tools >Developer tools
  • Elements > Control+F  to open search box
  • Type in your xpath Eg : .//input[@type='password']
OR
  • User can also validate Xpath using "Console" tab similar to FireFox
Rest is same as FireFox.

You can also try:

  1. Press F12 to open Chrome Developer Tool
  2. In "Elements" panel, press Ctrl+F
  3. In the search box, type in XPath or CSS Selector, if elements are found, they will be highlighted in yellow.


2 comments:

  1. Selenium WebDriver fits in the same role as RC did, and has incorporated the original 1.x bindings. It refers to both the language bindings and the implementations of the individual browser controlling code. This is commonly referred to as just "WebDriver" or sometimes as Selenium 2.
    Selenium Training Institute in Chennai
    Online Selenium Training in Chennai
    Selenium Course Fees

    ReplyDelete