Adsense

Write own code which help us to find the xpath from web elements

By the help of your document I am able to write a below function:

public WebElement getElementByXpath(WebDriver driver,String element)
{
JavascriptExecutor js = (JavascriptExecutor)driver;
WebElement ele = (WebElement)((JavascriptExecutor)driver).executeScript("return document.evaluate("+'"'+element+'"'+", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue");
return ele;
}

1 comment:

comment here

newest questions on wordpress