.id(id)
Find element(s) by their ID. For Android this is the resource-id
attribute, whereas for iOS it's the name
attribute.
Usage
by.id(id)
Returns
Matcher
: A matcher to be used when finding elements.
Support
Platform | Supported |
---|---|
iOS | Yes |
Android | Yes |
Web | Yes |
Examples
Find an element with an id of "button".
const { element, by } = require("appdriver");
(async () => {
const $button = await element(by.id("button"));
})();
Find multiple elements with an id starting with "list-item-".
const { elements, by } = require("appdriver");
(async () => {
const $listItems = await elements(by.id(/^list-item-.*$/));
})();