· 6 years ago · Oct 06, 2019, 10:32 PM
1@Before
2 public void beforeEach() {
3 // Initialize the Runner for your test.
4 runner = new ClassicRunner();
5
6 // Initialize the eyes SDK
7 eyes = new Eyes(runner);
8
9 // Raise an error if no API Key has been found.
10 if(isNullOrEmpty(System.getenv("APPLITOOLS_API_KEY"))) {
11 throw new RuntimeException("No API Key found; Please set environment variable 'APPLITOOLS_API_KEY'.");
12 }
13
14 // Set batch name
15 eyes.setBatch(batch);
16
17 // Use ChromeOptions to set the binary to the path where Edge Chromium is installed
18 ChromeOptions options = new ChromeOptions();
19 options.setBinary("/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta");
20
21 // Then merge with EdgeOptions()
22 EdgeOptions edgeOptions = new EdgeOptions().merge(options);
23
24 // Create the EdgeDriver
25 driver = new EdgeDriver(edgeOptions);
26}