Elements has "lazy" interface (as it was in protractor)
const { seleniumWD } = require('promod');
const { By, $$ } = seleniumWD;
// css
const elementsByCss = $$('.class #id div a[href*="link"]'); // css selector
const elementsByXpath = $$('xpath=.//div[@data-test="id"]/span'); // xpath selector
const elementsByJS = $$(() => document.querySelectorAll("div>span")); // js selector
const elementWithByInterface = $$(By.className('class')); // By object interface
const { seleniumWD } = require('promod');
const { $$ } = seleniumWD;
const someInput = $$('input').get(3);
(async () => {
await someInput.sendKeys('some value');
})();
const { seleniumWD } = require('promod');
const { $$ } = seleniumWD;
const someButton = $$('button').first();
(async () => {
await someButton.click();
})();
const { seleniumWD } = require('promod');
const { $$ } = seleniumWD;
const someButton = $$('button').last();
(async () => {
await someButton.click();
})();
const {seleniumWD} = require('promod');
const {$$} = seleniumWD
const someButtons = $$('button');
;(async () => {
await someButtons.each((someButton) => {
await someButton.click()
})
})()
const {seleniumWD} = require('promod');
const {$$} = seleniumWD
const someButtons = $$('button');
;(async () => {
const allButtonTexts = await someButtons.map((button) => {
return await someButton.getText()
})
})()
const {seleniumWD} = require('promod');
const {$$} = seleniumWD
const someButtons = $$('button');
;(async () => {
const isSomeButtonVisible = await someButtons.some((button) => {
return await someButton.isDisplayed()
})
})()
const {seleniumWD} = require('promod');
const {$$} = seleniumWD
const someButtons = $$('button');
;(async () => {
const isEveryButtonVisible = await someButtons.every((button) => {
return await someButton.isDisplayed()
})
})()