How to use the selenium-webdriver.until.elementLocated function in selenium-webdriver

To help you get started, we’ve selected a few selenium-webdriver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marmelab / react-admin / e2e / pages / ListPage.js View on Github external
showFilter(name) {
        const addFilterButton = driver.findElement(
            this.elements.addFilterButton
        );
        addFilterButton.click();
        driver.sleep(500); // wait until the dropdown animation ends
        driver.wait(until.elementLocated(this.elements.filterMenuItem(name)));
        driver.findElement(this.elements.filterMenuItem(name)).click();
        return this.waitUntilDataLoaded();
    },
github timeoff-management / application / t / lib / login_with_user.js View on Github external
// Check that there is a login button
  driver.findElement( By.css('a[href="/login/"]') )
    .then(function(el){
      return el.getText();
    })
    .then(function(text){
      expect(text).to.be.equal('Login');
    });

  // Click on Login button
  driver.findElement( By.css('a[href="/login/"]') )
    .then(function(el){
      return el.click();
    });

  driver.wait(until.elementLocated(By.css('h1')), 1000);

  // Check that it is actually login page
  driver.findElement( By.css('h1') )
    .then(function(el){
      return el.getText();
    })
    .then(function(text){
      expect(text).to.be.equal('Login');
    });

  // Fill login form
  Promise.all([
    _.map(
      [
        {
          selector : 'input[name="username"]',
github ScottLogic / finput / test / pageObjects / index.js View on Github external
export const load = async () => {
  await driver.get(`${__baseUrl__}/`);
  await driver.wait(until.elementLocated(root), defaultTimeout);
};
github material-components / material-components-web / test / screenshot / infra / lib / selenium-api.js View on Github external
async capturePageAsPng_({driver, userAgent, url, delayMs = 0}) {
    this.logStatus_(CliStatuses.GET, `${url} > ${userAgent.alias}...`);

    const isOnline = await this.cli_.isOnline();
    const fontTimeoutMs = isOnline ? SELENIUM_FONT_LOAD_WAIT_MS : 500;

    await driver.get(url);
    await driver.wait(until.elementLocated(By.css('[data-fonts-loaded]')), fontTimeoutMs).catch(() => 0);

    if (delayMs > 0) {
      await driver.sleep(delayMs);
    }

    const uncroppedImageBuffer = Buffer.from(await driver.takeScreenshot(), 'base64');
    const croppedImageBuffer = await this.imageCropper_.autoCropImage(uncroppedImageBuffer);

    const uncroppedJimpImage = await Jimp.read(uncroppedImageBuffer);
    const croppedJimpImage = await Jimp.read(croppedImageBuffer);

    const {width: uncroppedWidth, height: uncroppedHeight} = uncroppedJimpImage.bitmap;
    const {width: croppedWidth, height: croppedHeight} = croppedJimpImage.bitmap;

    const message = `${url} > ${userAgent.alias} screenshot from ` +
      `${uncroppedWidth}x${uncroppedHeight} to ${croppedWidth}x${croppedHeight}`;
github Automattic / wp-e2e-tests / lib / pages / customizer-page.js View on Github external
async waitForCustomizer() {
		const self = this;
		self.driver
			.wait( until.elementLocated( this.metaiFrameElementSelector ), this.explicitWaitMS * 2 )
			.then(
				function() {},
				function( error ) {
					const message = `Found issue on customizer page: '${ error }' - Clicking try again button now.`;
					slackNotifier.warn( message );
					self.driver
						.wait( function() {
							return driverHelper.isElementPresent( self.driver, self.reloadCustomizerSelector );
						}, self.explicitWaitMS )
						.then(
							function() {
								driverHelper.clickWhenClickable(
									self.driver,
									self.reloadCustomizerSelector,
									self.explicitWaitMS
								);
github microsoft / BotFramework-WebChat / __tests__ / setup / conditions / webChatLoaded.js View on Github external
export default function webChatLoaded() {
  return until.elementLocated(By.css('[role="log"]'));
}
github wazuh / wazuh-kibana-app / server / reporting / auto-report.ts View on Github external
async waitToReport() {
    try {
      const toasts = await this.driver.wait(until.elementLocated(By.css('div.euiGlobalToastList')), 10000);
      await this.driver.wait(until.elementTextContains(toasts, 'Reporting. Success.'), 60000);
      return true;
    } catch (error) {
      return false;
    }
  }
github ueokande / vim-vixen / e2e / lib / FormOptionPage.ts View on Github external
async addSearchEngine(): Promise {
    const rows = await this.webdriver.findElements(By.css(`.form-search-form-row > .column-name`));
    const button = await this.webdriver.findElement(By.css('.form-search-form > .ui-add-button'))
    await button.click();
    await this.webdriver.wait(until.elementLocated(By.css(`.form-search-form-row:nth-child(${rows.length + 1})`)));
  }
github marmelab / react-admin / e2e / pages / EditPage.js View on Github external
waitUntilVisible() {
        return driver.wait(until.elementLocated(this.elements.title));
    },