Namespace: Binder

binder

binder(driver) → {Object|Error}

binder

In binder api when we paas driver, it will return all web-driver api's which you can use without passing "driver" parameter. You just have to pass the other arguments (as e.g. xpath, class, id, tagname, etc.).
Parameters:
Name Type Attributes Description
driver Object

webdriver object of web browser.

Returns:

return a object of web-automate "Api".

Type
Object | Error

Examples

Examples usage of binder with "untilElementLocated" api.

 const { untilElementLocated } = binder(driver); 
  untilElementLocated({ 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 binder with "findElement" api.

 const { findElement } = binder(driver); 
  findElement({ 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
});
Note: Similarly, you can use other api's of web-automate just pass driver once. Everything will work same as before only you don't need to use the "driver" as parameter again and again.