Thursday, August 30, 2012

XPATH identification using FIREBUG - Mozilla Firefox

XPATH identification using FIREBUG - Mozilla Firefox

Download from https://addons.mozilla.org/en-us/firefox/addon/firebug/




         Install and Restart the browser.
    Search for any keyword > Right click on the element > Click “Inspect element wit Firebug”.



   First of all click on the “Arrow button” displayed on the Left hand side of the browser to activate.
   Mouse over any element and click the element.
   The HTML source of the element is displayed.
For e.g. <div class="f kv”> in this case



   Copy the HTML source and format accordingly to use it in your selenium automation script.
So your formatted XPATH would look something like:
(“//div[\@class=\"f kv\”]”)
  
 Similarly the source of images in web application can be checked 


 Unformatted HTML source:-

<img width="764height="768aria-label="sony-digital-cameraalt="" src=http://www.techpin.com/wp-content/uploads/2010/04/sony-digital-camera.jpg>

      The formatted XPATH would look something like:

(“//img[\@width=\"764\"][\@height=\"768\"][\@aria-label=\"sony-digital-camera\"][\@alt=\"\"][\@src=\"http:\/\/www.techpin.com\/wp-content\/uploads\/2010\/04\/sony-digital-camera.jpg\"]”)





No comments:

Post a Comment