88import org .openqa .selenium .WebDriver ;
99import org .openqa .selenium .chrome .ChromeDriver ;
1010import org .openqa .selenium .chrome .ChromeOptions ;
11+ import org .openqa .selenium .remote .RemoteWebDriver ;
1112import org .springframework .boot .test .context .SpringBootTest ;
1213import org .springframework .boot .test .context .SpringBootTest .WebEnvironment ;
1314import org .springframework .boot .web .server .LocalServerPort ;
1415
16+ import java .net .MalformedURLException ;
17+ import java .net .URL ;
1518import java .util .concurrent .TimeUnit ;
1619
1720import static org .junit .jupiter .api .Assertions .assertEquals ;
@@ -56,7 +59,7 @@ void newpage() {
5659 }
5760
5861 @ Test
59- public void user_is_on_application_homepage () throws InterruptedException {
62+ public void user_is_on_application_homepage () throws InterruptedException , MalformedURLException {
6063
6164
6265 System .out .println ("Opening Browser..." );
@@ -68,12 +71,16 @@ public void user_is_on_application_homepage() throws InterruptedException {
6871 }
6972 else {
7073 // use the chrome driver in docker instance
71- WebDriverManager .chromedriver ().setup ();
74+ // testing remote webdriver - us this to launch docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome:latest
75+ System .out .println ("Connecting to Hub" );
76+ String nodeURL ;
77+ nodeURL = "http://localhost:4444/wd/hub" ;
7278 ChromeOptions options = new ChromeOptions ();
7379 options .addArguments ("--no-sandbox" );
7480 options .addArguments ("--headless" );
75- options .addArguments ("--disable-dev-shm-usage" );
76- options .addArguments ("--disable-gpu" );
81+ driver = new RemoteWebDriver (new URL (nodeURL ), options );
82+ System .out .println ("Hub connection is good!" );
83+
7784 driver = new ChromeDriver (options );
7885 }
7986 driver .manage ().timeouts ().implicitlyWait (30 , TimeUnit .SECONDS );
0 commit comments