findElementByXpath(driver, xpath) → {Object}
findElementByXpath
Parameters:
Name | Type | Description |
---|---|---|
driver |
Object |
webdriver object of web browser. |
xpath |
String |
xpath of HTML element in dom. |
Returns:
return a object of "webElement".
- Type
- Object
Example
Examples usage of findElementByXpath by HTML element xpath
findElementByXpath(driver, '//*[@id="testXpath"]/div').then((webElement) => {
// After resolve promise We'll get the "webElement" object for HTML element whose "xpath" we pass.
// Here '//*[@id="testXpath"]/div' is xpath of HTML in dom.
}).catch((error) => {
// handle error
});