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;
}
This comment has been removed by the author.
ReplyDelete