Skip to content

Commit 332735e

Browse files
committed
Make sure Options do not require DesiredCapabilities
1 parent 04d5365 commit 332735e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

java/client/src/org/openqa/selenium/chrome/ChromeOptions.java

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import org.openqa.selenium.PageLoadStrategy;
3333
import org.openqa.selenium.SessionNotCreatedException;
3434
import org.openqa.selenium.UnexpectedAlertBehaviour;
35+
import org.openqa.selenium.remote.BrowserType;
36+
import org.openqa.selenium.remote.CapabilityType;
3537
import org.openqa.selenium.remote.DesiredCapabilities;
3638

3739
import java.io.File;
@@ -77,6 +79,10 @@ public class ChromeOptions extends MutableCapabilities {
7779
private List<String> extensions = Lists.newArrayList();
7880
private Map<String, Object> experimentalOptions = Maps.newHashMap();
7981

82+
public ChromeOptions() {
83+
setCapability(CapabilityType.BROWSER_NAME, BrowserType.CHROME);
84+
}
85+
8086
/**
8187
* Sets the path to the Chrome executable. This path should exist on the
8288
* machine which will launch Chrome. The path should either be absolute or

java/client/src/org/openqa/selenium/ie/InternetExplorerOptions.java

+8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
import static org.openqa.selenium.ie.InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS;
3030
import static org.openqa.selenium.ie.InternetExplorerDriver.NATIVE_EVENTS;
3131
import static org.openqa.selenium.ie.InternetExplorerDriver.REQUIRE_WINDOW_FOCUS;
32+
import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;
3233
import static org.openqa.selenium.remote.CapabilityType.PAGE_LOAD_STRATEGY;
34+
import static org.openqa.selenium.remote.CapabilityType.PLATFORM;
3335
import static org.openqa.selenium.remote.CapabilityType.UNHANDLED_PROMPT_BEHAVIOUR;
3436

3537
import com.google.common.base.Preconditions;
@@ -41,8 +43,11 @@
4143
import org.openqa.selenium.Capabilities;
4244
import org.openqa.selenium.MutableCapabilities;
4345
import org.openqa.selenium.PageLoadStrategy;
46+
import org.openqa.selenium.Platform;
4447
import org.openqa.selenium.UnexpectedAlertBehaviour;
4548
import org.openqa.selenium.internal.ElementScrollBehavior;
49+
import org.openqa.selenium.remote.BrowserType;
50+
import org.openqa.selenium.remote.CapabilityType;
4651
import org.openqa.selenium.remote.DesiredCapabilities;
4752

4853
import java.time.Duration;
@@ -99,6 +104,9 @@ public InternetExplorerOptions(Capabilities source) {
99104
super();
100105

101106
setCapability(IE_OPTIONS, ieOptions);
107+
setCapability(BROWSER_NAME, BrowserType.IE);
108+
setCapability(PLATFORM, Platform.WINDOWS);
109+
setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
102110

103111
merge(source);
104112
}

0 commit comments

Comments
 (0)