Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 8568406

Browse files
committed
Merge pull request #36 from smccarthy/ieprotectedmode
Ieprotectedmode - Check if Windows OS
2 parents 5e2b671 + d853de2 commit 8568406

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

SeleniumGridExtras/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
</repositories>
2121

2222
<dependencies>
23+
<dependency>
24+
<groupId>net.java.dev.jna</groupId>
25+
<artifactId>jna-platform</artifactId>
26+
<version>4.1.0</version>
27+
</dependency>
2328
<dependency>
2429
<groupId>org.seleniumhq.selenium</groupId>
2530
<artifactId>selenium-server</artifactId>

SeleniumGridExtras/src/main/java/com/groupon/seleniumgridextras/tasks/IEProtectedMode.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939

4040
import com.google.gson.JsonObject;
4141

42-
import com.groupon.seleniumgridextras.ExecuteCommand;
43-
42+
import com.groupon.seleniumgridextras.config.RuntimeConfig;
4443
import java.util.HashMap;
4544
import java.util.Map;
4645

@@ -106,8 +105,6 @@ public String getCurrentSettingForZone(String zoneId) {
106105
return String.format(regLocation, zoneId);
107106
}
108107

109-
;
110-
111108

112109
@Override
113110
public JsonObject execute(Map<String, String> parameter) {
@@ -119,14 +116,24 @@ public JsonObject execute(Map<String, String> parameter) {
119116

120117
@Override
121118
public JsonObject execute() {
122-
return getAllProtectedStatus();
119+
if (RuntimeConfig.getOS().isWindows()) {
120+
return getAllProtectedStatus();
121+
} else {
122+
getJsonResponse().addKeyValues("error", "IE Protected Mode command is only implemented in Windows");
123+
return getJsonResponse().getJson();
124+
}
123125
}
124126

125127
@Override
126128
public JsonObject execute(String status) {
127-
setAllProtectedStatuses(status.equals("1") ? true : false);
128-
getJsonResponse().addKeyValues("out", "IE needs to restart before you see the changes");
129-
return getAllProtectedStatus();
129+
if (RuntimeConfig.getOS().isWindows()) {
130+
setAllProtectedStatuses(status.equals("1") ? true : false);
131+
getJsonResponse().addKeyValues("out", "IE needs to restart before you see the changes");
132+
return getAllProtectedStatus();
133+
} else {
134+
getJsonResponse().addKeyValues("error", "IE Protected Mode command is only implemented in Windows");
135+
return getJsonResponse().getJson();
136+
}
130137
}
131138

132139
private void setAllProtectedStatuses(boolean value) {
@@ -142,8 +149,6 @@ private void setAllProtectedStatuses(boolean value) {
142149
}
143150
}
144151

145-
;
146-
147152

148153
private Boolean getProtectedEnabledForZone(String zone) {
149154
int enabled =

0 commit comments

Comments
 (0)