Thursday, 30 July 2015

XPath to Css Conversion

Open the Firefox Browser with the URL.
Launch 'Firebug' addon in Firefox browser.

Click on 'Inspect Icon' in Firebug and move the mouse on to the web element for which you want to capture the Xpath.

Copy the XPath captured.
Ex: '//*[@id='rso']/div[2]/div[3]/div/h3/a'

Open the URL http://cssify.appspot.com/
Copy the XPath in the text field and click 'Submit' button.

Css locator is displayed for the XPath provided.

Note: 
- cssify will work only with the XPath
- cssify may not convert some of the XPath's
   ex: //div[@class='rc']/h3/a[text()='WebDriver']
- cssify with not work with converting XPath Axes
   ex: //div[@class='rc']/h3/a[text()='WebDriver']/parent::* 

No comments:

Post a Comment