Search in sources :

Example 96 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project devonfw-testing by devonfw.

the class JavaScriptAlertsPage method clickAlertButton.

public void clickAlertButton() {
    new Button(selectorAlertButton).click();
    WebDriverWait wait = new WebDriverWait(getDriver(), 2);
    wait.until(ExpectedConditions.alertIsPresent());
}
Also used : Button(com.capgemini.ntc.selenium.core.newDrivers.elementType.Button) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 97 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project selenium_java by sergueik.

the class FirefoxTest method test.

@Test
public void test() {
    // Your test code here. For example:
    // 30 seconds of timeout
    WebDriverWait wait = new WebDriverWait(driver, 30);
    // navigate to
    driver.get("https://en.wikipedia.org/wiki/Main_Page");
    // Wikipedia
    // search for "Software"
    By searchInput = By.id("searchInput");
    wait.until(ExpectedConditions.presenceOfElementLocated(searchInput));
    driver.findElement(searchInput).sendKeys("Software");
    By searchButton = By.id("searchButton");
    wait.until(ExpectedConditions.elementToBeClickable(searchButton));
    driver.findElement(searchButton).click();
    wait.until(ExpectedConditions.textToBePresentInElementLocated(By.tagName("body"), // assert that the resulting
    "Computer software"));
// page contains a text
}
Also used : By(org.openqa.selenium.By) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Test(org.junit.Test)

Example 98 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project selenium_java by sergueik.

the class MultipleBrowsersTest method test.

@Test
public void test() {
    // Your test code here. For example:
    // 30 seconds of timeout
    WebDriverWait wait = new WebDriverWait(driver, 30);
    // navigate to Wikipedia
    driver.get("https://en.wikipedia.org/wiki/Main_Page");
    // search for "Software"
    By searchInput = By.id("searchInput");
    wait.until(ExpectedConditions.presenceOfElementLocated(searchInput));
    driver.findElement(searchInput).sendKeys("Software");
    By searchButton = By.id("searchButton");
    wait.until(ExpectedConditions.elementToBeClickable(searchButton));
    driver.findElement(searchButton).click();
    wait.until(ExpectedConditions.textToBePresentInElementLocated(By.tagName("body"), // assert that the resulting page contains a text
    "Computer software"));
}
Also used : By(org.openqa.selenium.By) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Test(org.junit.Test)

Example 99 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project selenium_java by sergueik.

the class AppTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    driver = new FirefoxDriver();
    wait = new WebDriverWait(driver, flexible_wait_interval);
    wait.pollingEvery(wait_polling_interval, TimeUnit.MILLISECONDS);
    driver.manage().timeouts().implicitlyWait(implicit_wait_interval, TimeUnit.SECONDS);
    actions = new Actions(driver);
}
Also used : FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Actions(org.openqa.selenium.interactions.Actions) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) BeforeClass(org.junit.BeforeClass)

Example 100 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project selenium_java by sergueik.

the class ChromePagePerformanceUtil method getLoadTime.

public double getLoadTime(WebDriver driver, By navigator) {
    WebDriverWait wait = new WebDriverWait(driver, flexibleWait);
    wait.until(ExpectedConditions.presenceOfElementLocated(navigator)).click();
    waitPageToLoad(driver, wait);
    setTimer(driver);
    return calculateLoadTime();
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Aggregations

WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)527 WebElement (org.openqa.selenium.WebElement)166 WebDriver (org.openqa.selenium.WebDriver)131 Test (org.junit.Test)86 By (org.openqa.selenium.By)54 Actions (org.openqa.selenium.interactions.Actions)53 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)43 TimeoutException (org.openqa.selenium.TimeoutException)38 ExpectedCondition (org.openqa.selenium.support.ui.ExpectedCondition)36 IOException (java.io.IOException)28 List (java.util.List)26 Wait (org.openqa.selenium.support.ui.Wait)25 BeforeClass (org.junit.BeforeClass)24 NgWebDriver (com.github.sergueik.jprotractor.NgWebDriver)21 ArrayList (java.util.ArrayList)21 WebDriverException (org.openqa.selenium.WebDriverException)21 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)21 Dimension (org.openqa.selenium.Dimension)20 File (java.io.File)16 NoSuchElementException (org.openqa.selenium.NoSuchElementException)16