|
102 | 102 | import org.openqa.selenium.chrome.ChromeOptions; |
103 | 103 | import org.openqa.selenium.edge.EdgeDriver; |
104 | 104 | import org.openqa.selenium.edge.EdgeDriverService; |
| 105 | +import org.openqa.selenium.edge.EdgeOptions; |
105 | 106 | import org.openqa.selenium.firefox.FirefoxDriver; |
| 107 | +import org.openqa.selenium.firefox.FirefoxDriverService; |
106 | 108 | import org.openqa.selenium.firefox.FirefoxOptions; |
107 | 109 | import org.openqa.selenium.firefox.FirefoxProfile; |
| 110 | +import org.openqa.selenium.firefox.GeckoDriverService; |
108 | 111 | import org.openqa.selenium.ie.InternetExplorerDriver; |
109 | 112 | import org.openqa.selenium.ie.InternetExplorerDriverService; |
110 | 113 | import org.openqa.selenium.ie.InternetExplorerOptions; |
@@ -523,19 +526,39 @@ protected WebDriver buildWebDriver() throws IOException { |
523 | 526 |
|
524 | 527 | if (BrowserVersion.EDGE == getBrowserVersion()) { |
525 | 528 | if (EDGE_BIN_ != null) { |
526 | | - System.setProperty(EdgeDriverService.EDGE_DRIVER_EXE_PROPERTY, EDGE_BIN_); |
| 529 | + final EdgeDriverService service = new EdgeDriverService.Builder() |
| 530 | + .withLogOutput(System.out) |
| 531 | + .usingDriverExecutable(new File(EDGE_BIN_)) |
| 532 | + |
| 533 | + .withAppendLog(true) |
| 534 | + .withReadableTimestamp(true) |
| 535 | + |
| 536 | + .build(); |
| 537 | + |
| 538 | + final EdgeOptions options = new EdgeOptions(); |
| 539 | + // options.addArguments("--lang=en-US"); |
| 540 | + // options.addArguments("--remote-allow-origins=*"); |
| 541 | + |
| 542 | + return new EdgeDriver(service, options); |
527 | 543 | } |
528 | 544 | return new EdgeDriver(); |
529 | 545 | } |
530 | 546 |
|
531 | 547 | if (BrowserVersion.CHROME == getBrowserVersion()) { |
532 | | - if (CHROME_BIN_ != null) { |
533 | | - System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY, CHROME_BIN_); |
534 | | - } |
| 548 | + final ChromeDriverService service = new ChromeDriverService.Builder() |
| 549 | + .withLogOutput(System.out) |
| 550 | + .usingDriverExecutable(new File(CHROME_BIN_)) |
| 551 | + |
| 552 | + .withAppendLog(true) |
| 553 | + .withReadableTimestamp(true) |
| 554 | + |
| 555 | + .build(); |
| 556 | + |
535 | 557 | final ChromeOptions options = new ChromeOptions(); |
536 | 558 | options.addArguments("--lang=en-US"); |
| 559 | + options.addArguments("--remote-allow-origins=*"); |
537 | 560 |
|
538 | | - return new ChromeDriver(options); |
| 561 | + return new ChromeDriver(service, options); |
539 | 562 | } |
540 | 563 |
|
541 | 564 | if (BrowserVersion.FIREFOX == getBrowserVersion()) { |
@@ -573,23 +596,19 @@ protected WebClient newWebClient(final BrowserVersion version) { |
573 | 596 | } |
574 | 597 |
|
575 | 598 | private static FirefoxDriver createFirefoxDriver(final String geckodriverBinary, final String binary) { |
576 | | - if (geckodriverBinary != null |
577 | | - && !geckodriverBinary.equals(System.getProperty("webdriver.gecko.driver"))) { |
578 | | - System.setProperty("webdriver.gecko.driver", geckodriverBinary); |
579 | | - } |
580 | | - |
581 | | - if (binary != null) { |
582 | | - final FirefoxOptions options = new FirefoxOptions(); |
583 | | - options.setBinary(binary); |
584 | | - |
585 | | - // at least FF79 is not stable when using a profile |
586 | | - final FirefoxProfile profile = new FirefoxProfile(); |
587 | | - profile.setPreference("intl.accept_languages", "en-US"); |
588 | | - options.setProfile(profile); |
589 | | - return new FirefoxDriver(options); |
590 | | - } |
591 | | - |
592 | | - return new FirefoxDriver(); |
| 599 | + final FirefoxDriverService service = new GeckoDriverService.Builder() |
| 600 | + .withLogOutput(System.out) |
| 601 | + .usingDriverExecutable(new File(geckodriverBinary)) |
| 602 | + .build(); |
| 603 | + |
| 604 | + final FirefoxOptions options = new FirefoxOptions(); |
| 605 | + options.setCapability("webSocketUrl", true); |
| 606 | + options.setBinary(binary); |
| 607 | + |
| 608 | + final FirefoxProfile profile = new FirefoxProfile(); |
| 609 | + profile.setPreference("intl.accept_languages", "en-US,en"); |
| 610 | + options.setProfile(profile); |
| 611 | + return new FirefoxDriver(service, options); |
593 | 612 | } |
594 | 613 |
|
595 | 614 | private static String getBrowserName(final BrowserVersion browserVersion) { |
|
0 commit comments