1717import org .openqa .selenium .WebDriver ;
1818import org .openqa .selenium .chrome .ChromeDriver ;
1919import org .openqa .selenium .chrome .ChromeOptions ;
20+ import org .openqa .selenium .remote .RemoteWebDriver ;
2021
22+ import java .net .URL ;
2123import java .time .Duration ;
2224
2325
@@ -29,6 +31,7 @@ public class AcmeBankTests {
2931
3032 // Test constants
3133 private final static boolean USE_ULTRAFAST_GRID = true ;
34+ private final static boolean USE_EXECUTION_CLOUD = false ;
3235 private final static String RUNNER_NAME = (USE_ULTRAFAST_GRID ) ? "Ultrafast Grid" : "Classic runner" ;
3336 private final static BatchInfo BATCH = new BatchInfo ("Example: Selenium Java Basic with the " + RUNNER_NAME );
3437
@@ -91,8 +94,17 @@ public static void main(String [] args) {
9194 // Set the configuration for Eyes
9295 eyes .setConfiguration (config );
9396
94- // Open the browser with the ChromeDriver instance.
95- driver = new ChromeDriver (new ChromeOptions ().setHeadless (headless ));
97+ // Create ChromeDriver options
98+ ChromeOptions options = new ChromeOptions ().setHeadless (headless );
99+
100+ if (USE_EXECUTION_CLOUD ) {
101+ // Open the browser remotely in the Execution Cloud.
102+ driver = new RemoteWebDriver (new URL (Eyes .getExecutionCloudURL ()), options );
103+ }
104+ else {
105+ // Open the browser with a local ChromeDriver instance.
106+ driver = new ChromeDriver (options );
107+ }
96108
97109 // Set an implicit wait of 10 seconds.
98110 // For larger projects, use explicit waits for better control.
0 commit comments