@assert-equals/dappdriver
Version:
DappDriver is an e2e testing framework designed for testing decentralized applications (dApps) using MetaMask, Rainbow or Zerion
35 lines (34 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebDriverDropDown = void 0;
const select_1 = require("selenium-webdriver/lib/select");
const html_element_1 = require("./html-element");
class WebDriverDropDown extends html_element_1.WebDriverHTMLElement {
constructor(cssLocator) {
super(cssLocator);
}
async getSelectedOption() {
await this.search();
const select = new select_1.Select(this.webElement);
return (await select.getFirstSelectedOption()).getText();
}
async getText() {
return await this.getSelectedOption();
}
async selectByIndex(index) {
await this.search();
const select = new select_1.Select(this.webElement);
await select.selectByIndex(index);
}
async selectByText(text) {
await this.search();
const select = new select_1.Select(this.webElement);
await select.selectByVisibleText(text);
}
async selectByValue(value) {
await this.search();
const select = new select_1.Select(this.webElement);
await select.selectByValue(value);
}
}
exports.WebDriverDropDown = WebDriverDropDown;