Skip to content

Commit

Permalink
[java] Adding constructors to EdgeDriver and EdgeHtmlDriver that acce…
Browse files Browse the repository at this point in the history
…pt a driver service. Fixes issue SeleniumHQ#8306
  • Loading branch information
barancev committed May 27, 2020
1 parent ea76096 commit 373d1fc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
19 changes: 9 additions & 10 deletions java/client/src/org/openqa/selenium/edge/EdgeDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.openqa.selenium.chromium.ChromiumDriver;
import org.openqa.selenium.chromium.ChromiumDriverCommandExecutor;
import org.openqa.selenium.internal.Require;
import org.openqa.selenium.remote.CommandExecutor;
import org.openqa.selenium.remote.RemoteWebDriver;


Expand Down Expand Up @@ -101,19 +100,19 @@ public class EdgeDriver extends ChromiumDriver {
public EdgeDriver() { this(new EdgeOptions()); }

public EdgeDriver(EdgeOptions options) {
super(toExecutor(options), options, EdgeOptions.CAPABILITY);
this(new EdgeDriverService.Builder().build(), options);
}

@Deprecated
public EdgeDriver(Capabilities capabilities) {
super(toExecutor(new EdgeOptions()), capabilities, EdgeOptions.CAPABILITY);
public EdgeDriver(EdgeDriverService service) {
this(service, new EdgeOptions());
}

private static CommandExecutor toExecutor(EdgeOptions options) {
Require.nonNull("Driver options", options);

EdgeDriverService.Builder builder = new EdgeDriverService.Builder();
public EdgeDriver(EdgeDriverService service, EdgeOptions options) {
super(new ChromiumDriverCommandExecutor("ms", service), Require.nonNull("Driver options", options), EdgeOptions.CAPABILITY);
}

return new ChromiumDriverCommandExecutor("ms", builder.build());
@Deprecated
public EdgeDriver(Capabilities capabilities) {
this(new EdgeDriverService.Builder().build(), new EdgeOptions().merge(capabilities));
}
}
13 changes: 6 additions & 7 deletions java/client/src/org/openqa/selenium/edgehtml/EdgeHtmlDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.internal.Require;
import org.openqa.selenium.remote.CommandExecutor;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.service.DriverCommandExecutor;

Expand Down Expand Up @@ -95,14 +94,14 @@ public class EdgeHtmlDriver extends RemoteWebDriver {
public EdgeHtmlDriver() { this(new EdgeHtmlOptions()); }

public EdgeHtmlDriver(EdgeHtmlOptions options) {
super(toExecutor(options), options);
this(new EdgeHtmlDriverService.Builder().build(), options);
}

private static CommandExecutor toExecutor(EdgeHtmlOptions options) {
Require.nonNull("Driver options", options);

EdgeHtmlDriverService.Builder builder = new EdgeHtmlDriverService.Builder();
public EdgeHtmlDriver(EdgeHtmlDriverService service) {
this(service, new EdgeHtmlOptions());
}

return new DriverCommandExecutor(builder.build());
public EdgeHtmlDriver(EdgeHtmlDriverService service, EdgeHtmlOptions options) {
super(new DriverCommandExecutor(new EdgeHtmlDriverService.Builder().build()), Require.nonNull("Driver options", options));
}
}

0 comments on commit 373d1fc

Please sign in to comment.