update test containers
This commit is contained in:
+5
-8
@@ -2,29 +2,26 @@ package com.baeldung.testconainers;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||
import org.openqa.selenium.chrome.ChromeOptions;
|
||||
import org.openqa.selenium.remote.RemoteWebDriver;
|
||||
import org.testcontainers.DockerClientFactory;
|
||||
import org.testcontainers.containers.BrowserWebDriverContainer;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
|
||||
public class WebDriverContainerLiveTest {
|
||||
@Rule
|
||||
public BrowserWebDriverContainer chrome
|
||||
= new BrowserWebDriverContainer()
|
||||
.withDesiredCapabilities(DesiredCapabilities.chrome());
|
||||
.withCapabilities(new ChromeOptions());
|
||||
|
||||
@Test
|
||||
public void whenNavigatedToPage_thenHeadingIsInThePage() {
|
||||
RemoteWebDriver driver = chrome.getWebDriver();
|
||||
driver.get("https://saucelabs.com/test/guinea-pig");
|
||||
String heading = driver.findElement(By.xpath("/html/body/h1"))
|
||||
driver.get("http://example.com");
|
||||
String heading = driver.findElement(By.xpath("/html/body/div/h1"))
|
||||
.getText();
|
||||
assertEquals("This page is a Selenium sandbox", heading);
|
||||
assertEquals("Example Domain", heading);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user