import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testcontainers.containers.BrowserWebDriverContainer;

import java.io.File;

import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue;
import static org.testcontainers.containers.BrowserWebDriverContainer.VncRecordingMode.RECORD_ALL;

/**
 * Simple example of plain Selenium usage.
 */
public class SeleniumContainerTest {

    @Rule
    public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer()
                                                    .withDesiredCapabilities(DesiredCapabilities.chrome())
                                                    .withRecordingMode(RECORD_ALL, new File("target"));

    @Test
    public void simplePlainSeleniumTest() {
        RemoteWebDriver driver = chrome.getWebDriver();

        driver.get("https://wikipedia.org");
        WebElement searchInput = driver.findElementByName("search");

        searchInput.sendKeys("Rick Astley");
        searchInput.submit();

        WebElement otherPage = driver.findElementByPartialLinkText("Rickrolling");
        otherPage.click();

        boolean expectedTextFound = driver.findElementsByCssSelector("p")
                .stream()
                .anyMatch(element -> element.getText().contains("meme"));

        assertTrue("The word 'meme' is found on a page about rickrolling", expectedTextFound);
    }
}

@@ -269,16 +269,39 @@
 io.File;
+%0Aimport java.util.List;
 %0A%0Aimport
@@ -1012,32 +1012,37 @@
 .org%22);%0A        
+List%3C
 WebElement searc
@@ -1035,16 +1035,17 @@
 bElement
+%3E
  searchI
@@ -1069,16 +1069,17 @@
 dElement
+s
 ByName(%22
@@ -1101,454 +1101,97 @@
     
-searchInput.sendKeys(%22Rick Astley%22);%0A       
+assertTrue(%22The
  search
-I
+ i
 nput
-.submit();%0A%0A        WebElement otherPage = driver.findElementByPartialLinkText(%22Rickrolling%22);%0A        otherPage.click();%0A%0A        boolean expectedTextFound = driver.findElementsByCssSelector(%22p%22)%0A                .stream()%0A                .anyMatch(element -%3E element.getText().contains(%22meme%22));%0A%0A        assertTrue(%22The word 'meme' is found on a page about rickrolling%22, expectedTextFound
+ box is found%22, searchInput != null && searchInput.size() %3E 0
 );%0A 

Simplify selenium example Previous test relied on the content/layout of wikipedia remaining the same, which led to unexpected failures