RemoteTest
This commit is contained in:
@@ -2,21 +2,15 @@ package com.agile611.testng.webdriver;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.remote.RemoteWebDriver;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class DuckDuckGoRemoteTest extends BaseRemoteWebDriverTest {
|
||||
@FindBy(id = "searchbox_input")
|
||||
public WebElement searchBox;
|
||||
|
||||
@FindBy(className = "react-results--main")
|
||||
public WebElement resultsList;
|
||||
|
||||
public void waitPageToLoad(RemoteWebDriver driver, long secondsTimeout, WebElement webElement){
|
||||
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(secondsTimeout));
|
||||
wait.until(ExpectedConditions.elementToBeClickable(webElement));
|
||||
@@ -25,10 +19,11 @@ public class DuckDuckGoRemoteTest extends BaseRemoteWebDriverTest {
|
||||
@Test
|
||||
public void testUntitledTestCase() throws Exception {
|
||||
driver.get("https://duckduckgo.com/");
|
||||
waitPageToLoad(driver, 10, searchBox);
|
||||
Thread.sleep(10000);
|
||||
WebElement searchBox = driver.findElement(By.id("searchbox_input"));
|
||||
searchBox.sendKeys("pizza hawaiana");
|
||||
searchBox.submit();
|
||||
waitPageToLoad(driver, 10, resultsList);
|
||||
WebElement resultsList = driver.findElement(By.className("react-results--main"));
|
||||
assertTrue(resultsList.isDisplayed());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user