UNPKG

@assert-equals/dappdriver

Version:

DappDriver is an e2e testing framework designed for testing decentralized applications (dApps) using MetaMask, Rainbow or Zerion

30 lines (29 loc) 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebDriverHTMLElementCollection = void 0; const html_element_1 = require("../controls/html-element"); const dapp_driver_1 = require("../session/dapp-driver"); class WebDriverHTMLElementCollection { cssLocator; timeout; driver; webElements; htmlElements = new Array(); constructor(cssLocator, timeout = 20000) { this.cssLocator = cssLocator; this.driver = dapp_driver_1.DappDriver.Instance.Driver; this.timeout = timeout; this.webElements = null; } async search() { await this.driver.manage().setTimeouts({ implicit: this.timeout }); this.webElements = await this.driver.findElements({ css: this.cssLocator }); await this.driver.manage().setTimeouts({ implicit: 20000 }); } async elements() { await this.search(); this.webElements.forEach((element) => this.htmlElements.push(new html_element_1.HTMLElement(this.cssLocator, this.timeout, element))); return this.htmlElements; } } exports.WebDriverHTMLElementCollection = WebDriverHTMLElementCollection;