untilElementsLocated(driver, path, timeopt) → {Array.<Object>|Error}
untilElementsLocated
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
driver |
Object |
webdriver object of web browser. |
|
path |
Object |
object of path type as xpath, id, className, tagName, name properties. |
|
time |
Number | <optional> |
time is optional.This parameter represent for how much time user want to wait for "webElement". After time finish it returns error. |
Returns:
return a Array of object of "webElement". If we pass time param & it will not get "webElement", it will return error.
- Type
- Array.<Object> | Error
Examples
Examples usage of untilElementsLocated by HTML element xpath
untilElementsLocated(driver, { xpath: '//*[@id="testXpath"]/div' }, time).then((webElement) => {
// After resolve promise We'll get the "webElement" Array of object for HTML element whose "xpath" we pass.
}).catch((error) => {
// handle error
});
Examples usage of untilElementsLocated by HTML element id
untilElementsLocated(driver, { id: 'testId' }, time).then((webElement) => {
// After resolve promise We'll get the "webElement" Array of object for HTML element whose "id" we pass.
}).catch((error) => {
// handle error
});
Examples usage of untilElementsLocated by HTML element class
untilElementsLocated(driver, { className: 'testClass' }, time).then((webElement) => {
// After resolve promise We'll get the "webElement" Array of object for HTML element whose "classname" we pass.
}).catch((error) => {
// handle error
});
Examples usage of untilElementsLocated by HTML element tagName
untilElementsLocated(driver, { tagName: 'span' }, time).then((webElement) => {
// After resolve promise We'll get the "webElement" Array of object for HTML element whose "tagname" we pass.
}).catch((error) => {
// handle error
});
Examples usage of untilElementsLocated by name property of HTML element
untilElementsLocated(driver, { name: 'testName' }, time).then((webElement) => {
// After resolve promise We'll get the "webElement" Array of object for HTML element whose "name" property we pass.
// 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
});