How to use the selenium-webdriver.By.xpath 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 amzn / oss-attribution-builder / spec / selenium / projects-auth.spec.ts View on Github external
it('wont let a person disown a project', async function() {
    const input = driver.findElement(
      By.xpath('//form//tbody/tr[1]//input[@type="text"]')
    );
    input.clear();
    input.sendKeys('blah');
    driver.findElement(By.css('button[type="submit"]')).click();

    driver.sleep(1000); // modal animation
    const errorText = await driver
      .findElement(By.css('#error-modal .modal-body'))
      .getText();
    expect(errorText).toContain('cannot remove yourself');
    driver.findElement(By.css('#error-modal button.btn-primary')).click(); // close button
    driver.wait(
      until.elementIsNotVisible(driver.findElement(By.css('#error-modal')))
    );
    driver.sleep(1000); // modal animation
github eclipse / che / tests / e2e / pageobjects / ide / Editor.ts View on Github external
public async waitTabFocused(tabTitle: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
        Logger.debug(`Editor.waitTabFocused "${tabTitle}"`);

        const focusedTabLocator: By = By.xpath(`//li[contains(@class, 'p-TabBar-tab') and contains(@class, 'theia-mod-active')]//div[text()='${tabTitle}']`);

        await this.driverHelper.waitVisibility(focusedTabLocator, timeout);
    }
github eclipse / che / tests / e2e / pageobjects / ide / Terminal.ts View on Github external
private getTerminalEditorInteractionEditorLocator(terminalIndex: number): By {
        return By.xpath(`(//textarea[@aria-label='Terminal input'])[${terminalIndex}]`);
    }
github Automattic / wp-e2e-tests / lib / pages / ios / editor-options-page-ios.js View on Github external
constructor( driver ) {
		super( driver, By.xpath( '//XCUIElementTypeTable[@name="SettingsTable"]' ) );

		this.tagsSelector = By.xpath( '//XCUIElementTypeTextField[@name="Tags Value"]' );
		this.backButtonSelector = By.xpath( '//XCUIElementTypeButton[@name="Back"]' );
	}
github Automattic / wp-e2e-tests / lib / pages / ios / site-details-page-ios.js View on Github external
clickMenuItem( name ) {
		const selector = By.xpath( `//XCUIElementTypeStaticText[@name="${name}"]` );

		return driverHelper.clickWhenClickableMobile( this.driver, selector );
	}
}
github rundeck / rundeck / test / selenium / src / pages / navigation.page.ts View on Github external
async toggleSidebarExpand() {
        const {ctx} = this
        const btn = ctx.driver.findElement(By.xpath(Elems.btnSideBarExpand))
        await btn.click()
    }
github Automattic / wp-e2e-tests / lib / pages / ios / main-page-ios.js View on Github external
constructor( driver ) {
		super( driver, By.xpath( '//UIATabBar[@name="Main Navigation"]' ) );
		this.driver = driver;
	}
github eclipse / che / tests / e2e / pageobjects / ide / Editor.ts View on Github external
private getSuggestionLineXpathLocator(suggestionText: string): By {
        return By.xpath(`//div[@widgetid='editor.widget.suggestWidget']//span[@class='monaco-highlighted-label' and contains(.,'${suggestionText}')]`);
    }
github amzn / oss-attribution-builder / spec / selenium / projects-auth.spec.ts View on Github external
it('can add some friends to the list', async function() {
    driver.findElement(By.id('acl-add')).click();
    const select2 = driver.findElement(By.xpath('//form//tbody/tr[2]//select'));
    const input2 = driver.findElement(
      By.xpath('//form//tbody/tr[2]//input[@type="text"]')
    );
    select2.click();
    const select2editor = driver.findElement(
      By.xpath('//form//tbody/tr[2]//select/option[@value="editor"]')
    );
    select2editor.click();
    input2.sendKeys('self:fake-editor');

    driver.findElement(By.id('acl-add')).click();
    const select3 = driver.findElement(By.xpath('//form//tbody/tr[3]//select'));
    const input3 = driver.findElement(
      By.xpath('//form//tbody/tr[3]//input[@type="text"]')
    );
    select3.click();
    const select3viewer = driver.findElement(
      By.xpath('//form//tbody/tr[3]//select/option[@value="viewer"]')
    );
    select3viewer.click();
    input3.sendKeys('self:fake-viewer');

    await driver.findElement(By.css('button[type="submit"]')).click();
  });
github everettsouthwick / amazon-auto-reload / src / sites / optimum.ts View on Github external
.click();
			await driver.findElement(By.css(".dropdown__option:nth-child(24) > .ng-binding"))
				.click();
		}

		const paymentAmount: WebElement = await driver.findElement(By.id("otherAmountInput"));
		await paymentAmount.click();
		await paymentAmount.sendKeys(card.reloadAmount);
		logger.debug("Completed filling Optimum form.");

		if (this.completeTransactions)
		{
			logger.debug("About to submit Optumum payment");
			await driver.findElement(By.id("otpSubmit"))
				.click();
			await driver.findElement(By.xpath("//input[@ng-click='oweAccepted()']"))
				.click();
			logger.debug("Submitted payment");
			card.reloadTimes -= 1;
		}
	}
}