Skip to content Skip to sidebar Skip to footer

Get Absolute XPath Of Web Element

I'm using Javascript in the following code to retrieve the absolute XPath of a web element: public String getAbsoluteXPath(WebDriver driver) { return (String) driver.executeSc

Solution 1:

On current page your code returns following value to me when try to identify WebElement

/html[1]/body[1]/div[3]/div[1]/div[1]/div[4]/div[6]/h4[1]/a[1]

Probably that is dependent on your session to the site and what sections are being displayed at that time; you can try seearching via xpath on the same session where you execute this code.


Post a Comment for "Get Absolute XPath Of Web Element"