Package org.openqa.selenium

Examples of org.openqa.selenium.Alert


    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath(alertLocator);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    try {
      alert.sendKeys("test");
      Assert.fail("should crash on sendKeys");
    } catch (InvalidElementStateException e) {
      //expected
    }
    alert.dismiss();
  }
View Full Code Here


    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"));
    Assert.assertEquals(field.getAttribute("value"), "");
    alert.sendKeys("test");
    Assert.assertEquals(field.getAttribute("value"), "••••");
    alert.accept();

    try {
      d.switchTo().alert();
      Assert.fail("alert should be gone.");
    } catch (NoAlertPresentException e) {
View Full Code Here

  }

  private Alert waitForAlert(WebDriver driver) {
    long timeoutInMs = 2000;
    long deadline = System.currentTimeMillis() + timeoutInMs;
    Alert res = null;
    while (res == null) {
      try {
        res = driver.switchTo().alert();
        return res;
      } catch (NoAlertPresentException e) {
View Full Code Here

 
  private void loadSupportPage()
  {
    driver.get(baseUrl + "/#note/latest");
    //accept leave page alert
    Alert alert = driver.switchTo().alert();
    alert.accept();
    assertTrue(driver.findElement(By.id("releaseNoteScreen")).isDisplayed());
  }
View Full Code Here

    assertEquals(CONFIG_URL, siteInput.getAttribute("value"));

    List<WebElement> deleteLink = driver.findElements(By.linkText("Delete Configuration"));
    followLink(deleteLink.get(0));

    Alert confirmDialog = driver.switchTo().alert();
    confirmDialog.accept();

    ExpectedCondition<Boolean> isDeleted = new ExpectedCondition<Boolean>() {
      public Boolean apply(WebDriver driver) {
        WebElement notification = driver.findElements(By.id("notification")).get(0);
        return notification.getText().equals("Configuration Deleted");
View Full Code Here

        "return $(\"a:contains('Delete')\").toArray()");

    while(deleteLinks.size() > 0) {
      final int count = deleteLinks.size();
      followLink(deleteLinks.get(0));
      Alert confirmDialog = driver.switchTo().alert();
      confirmDialog.accept();
      ExpectedCondition<Boolean> isDeleted = new ExpectedCondition<Boolean>() {
        public Boolean apply(WebDriver driver) {
          WebElement notification = driver.findElements(By.id("notification")).get(0);
          return notification.getText().equals("Plugin Deleted");
        }
View Full Code Here

    openConfiguration();

    List<WebElement> deleteLink = driver.findElements(By.linkText("Delete Configuration"));
    followLink(deleteLink.get(0));

    Alert confirmDialog = driver.switchTo().alert();
    confirmDialog.accept();

    open("configurations");
    List<WebElement> configurationLinks = (List<WebElement>) ((JavascriptExecutor)driver).executeScript(
        "return $(\"a:contains('" + CONFIG_NAME + "')\").toArray();");
View Full Code Here

    Thread.sleep(1000);
   
//    ����ύ��ť
    dr.findElement(By.cssSelector("input[type=submit]")).click();
   
    Alert alert = dr.switchTo().alert();
    System.out.println(alert.getText());
    alert.accept();
   
    Thread.sleep(1000);
    System.out.println("browser will be close");
    dr.quit()
  }
View Full Code Here

    Thread.sleep(1000);
   
//    ������ӵ���alert
    dr.findElement(By.id("tooltip")).click();
   
    Alert alert = dr.switchTo().alert();
    alert.accept();
           
    Thread.sleep(1000);
    System.out.println("browser will be close");
    dr.quit()
  }
View Full Code Here

        if (driver instanceof JavascriptExecutor) {
            JavascriptExecutor js = (JavascriptExecutor)driver;
            topTextField.sendKeys(String.valueOf(js.executeScript(TOP_COORDINATE_JS)));
            leftTextField.sendKeys(String.valueOf(js.executeScript(LEFT_COORDINATE_JS)));
            processButton.click();
            Alert alert = driver.switchTo().alert();
            s = alert.getText();
            alert.accept();
            //driver.switchTo().defaultContent();
        }
        return s;
    }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.Alert

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.