Package org.openqa.selenium

Examples of org.openqa.selenium.By


    element.tap();
  }

  @Test
  public void alertGetText() throws Exception {
    By b = By.xpath(alertOK);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    Assert.assertEquals(alert.getText(), "<Alert message>");
View Full Code Here


    Assert.assertEquals(tree.getString("type"), "UIAAlert");
    // IOS 6. Alert OK buttons are buttons.
    String version = driver.getCapabilities().getSDKVersion();
    IOSVersion v = new IOSVersion(version);

    By selector;
    if (v.isGreaterOrEqualTo("7")) {
      selector = By.className("UIATableCell");
    } else {
      selector = By.className("UIAButton");
    }
View Full Code Here


  @Test
  public void switchToAlert() throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath("//UIAStaticText[@name='Secure Text Input']");
    WebElement el = driver.findElement(b);
    try {
      d.switchTo().alert();
      Assert.fail("should have thrown");
    } catch (NoAlertPresentException e) {
View Full Code Here

  }

  @Test(dataProvider = "allAlerts")
  public void dismissAlert(String alertLocator) throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath(alertLocator);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    alert.dismiss();
View Full Code Here

  }

  @Test(dataProvider = "allAlerts")
  public void acceptAlert(String alertLocator) throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath(alertLocator);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    alert.accept();
View Full Code Here

  }

  @Test(dataProvider = "non-input")
  public void sendKeysAlertThrowsIfNoInput(String alertLocator) throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath(alertLocator);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    try {
View Full Code Here

  }

  @Test
  public void sendKeysAlert() throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath(alertPassword);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    WebElement field = driver.findElement(By.xpath("//UIAAlert//UIASecureTextField"));
View Full Code Here

                }
                if (desired == null) {
                  throw new WebDriverException("unknown pageId:" + pageId);
                }
                String title = desired.getTitle();
                By locator = By.xpath("//UIAStaticText[@name='" + title + "']");
                getNativeDriver().executeScript(
                    "new SafariPageNavigator().enter();");

                WebElement element = getNativeDriver().findElement(locator);
                try {
View Full Code Here

  }

  private WebElement getAddressBar() {


    By b = By.xpath("//UIAElement[@name=l10n('Address')] | //UIATextField[@value=l10n('Search or enter an address')]");


    addressBar = getNativeDriver().findElement(b);
    return addressBar;
  }
View Full Code Here

        }
    }

    protected final void setupPageFragmentList(SearchContext searchContext, Object target, Field field)
        throws ClassNotFoundException {
        By rootBy = FindByUtilities.getCorrectBy(field);
        if (rootBy == null) {
            throw new PageFragmentInitializationException("Your declaration of Page Fragment in test "
                + field.getDeclaringClass().getName() + " is annotated with @FindBy without any "
                + "parameters, in other words without reference to root of the particular Page Fragment on the page!"
                + NEW_LINE);
View Full Code Here

TOP

Related Classes of org.openqa.selenium.By

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.