Examples
Examples usage of clickElement by HTML element xpath
clickElement(driver, { xpath: '//*[@id="testXpath"]/div' }).then((webElement) => {
// After resolve promise We'll get the "webElement" object for HTML element whose "xpath" we pass.
// By the help of "webElement" we click on HTML element.
}).catch((error) => {
// handle error
});
Examples usage of clickElement by HTML element id
clickElement(driver, { id: 'testId' }).then((webElement) => {
// After resolve promise We'll get the "webElement" object for HTML element whose "id" we pass.
// By the help of "webElement" we click on HTML element.
}).catch((error) => {
// handle error
});
Examples usage of clickElement by HTML element class
clickElement(driver, { className: 'testClass' }).then((webElement) => {
// After resolve promise We'll get the "webElement" object for HTML element whose "classname" we pass.
// By the help of "webElement" we click on HTML element.
}).catch((error) => {
// handle error
});
Examples usage of clickElement by HTML element tagName
clickElement(driver, { tagName: 'span' }).then((webElement) => {
// After resolve promise We'll get the "webElement" object for HTML element whose "tagname" we pass.
// By the help of "webElement" we click on HTML element.
}).catch((error) => {
// handle error
});
Examples usage of clickElement by name property of HTML element
clickElement(driver, { name: 'testName' }).then((webElement) => {
// After resolve promise We'll get the "webElement" object for HTML element whose "name" property we pass.
// By the help of "webElement" we click on HTML element.
// Similarly we can access elemets HTML by using any attribute which used in HTML element.
// As we can pass title, for, alt etc. attributes of an HTML element.
}).catch((error) => {
// handle error
});