Skip to content

Commit 14873d0

Browse files
committed
add toggleLocationServices()
1 parent 6e1d06f commit 14873d0

File tree

6 files changed

+26
-15
lines changed

6 files changed

+26
-15
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ More can be found in the docs, but here's a quick list of features which this pr
6060
- Context Switching: .context(), .getContextHandles(), getContext())
6161
- getNetworkConnection(), setNetworkConnection()
6262
- ignoreUnimportantViews(), getSettings()
63+
- toggleLocationServices()
6364

6465
Locators:
6566
- findElementByAccessibilityId()

java-client.iml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,41 @@
2525
<orderEntry type="library" name="Maven: cglib:cglib-nodep:2.1_3" level="project" />
2626
<orderEntry type="library" name="Maven: org.json:json:20080701" level="project" />
2727
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-api:2.43.1" level="project" />
28-
<orderEntry type="library" name="Maven: com.google.guava:guava:17.0" level="project" />
29-
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.3.3" level="project" />
30-
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.3.2" level="project" />
31-
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.3" level="project" />
32-
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.6" level="project" />
33-
<orderEntry type="library" name="Maven: org.apache.commons:commons-exec:1.1" level="project" />
34-
<orderEntry type="library" name="Maven: net.java.dev.jna:jna:3.4.0" level="project" />
35-
<orderEntry type="library" name="Maven: net.java.dev.jna:platform:3.4.0" level="project" />
3628
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-htmlunit-driver:2.43.1" level="project" />
3729
<orderEntry type="library" name="Maven: net.sourceforge.htmlunit:htmlunit:2.15" level="project" />
3830
<orderEntry type="library" name="Maven: xalan:xalan:2.7.1" level="project" />
3931
<orderEntry type="library" name="Maven: xalan:serializer:2.7.1" level="project" />
40-
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
4132
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
4233
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.3.2" level="project" />
4334
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.3.3" level="project" />
4435
<orderEntry type="library" name="Maven: net.sourceforge.htmlunit:htmlunit-core-js:2.15" level="project" />
4536
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
37+
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
4638
<orderEntry type="library" name="Maven: net.sourceforge.nekohtml:nekohtml:1.9.21" level="project" />
4739
<orderEntry type="library" name="Maven: net.sourceforge.cssparser:cssparser:0.9.14" level="project" />
4840
<orderEntry type="library" name="Maven: org.w3c.css:sac:1.3" level="project" />
49-
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
5041
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-websocket:8.1.15.v20140411" level="project" />
5142
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:8.1.15.v20140411" level="project" />
5243
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:8.1.15.v20140411" level="project" />
5344
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:8.1.15.v20140411" level="project" />
5445
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-firefox-driver:2.43.1" level="project" />
46+
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
47+
<orderEntry type="library" name="Maven: org.apache.commons:commons-exec:1.1" level="project" />
5548
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-ie-driver:2.43.1" level="project" />
49+
<orderEntry type="library" name="Maven: net.java.dev.jna:jna:3.4.0" level="project" />
50+
<orderEntry type="library" name="Maven: net.java.dev.jna:platform:3.4.0" level="project" />
5651
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-safari-driver:2.43.1" level="project" />
52+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-support:2.43.1" level="project" />
5753
<orderEntry type="library" name="Maven: org.webbitserver:webbit:0.4.15" level="project" />
5854
<orderEntry type="library" name="Maven: io.netty:netty:3.5.5.Final" level="project" />
59-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-support:2.43.1" level="project" />
6055
<orderEntry type="library" name="Maven: junit:junit:4.11" level="project" />
6156
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
57+
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.3.3" level="project" />
58+
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.3.2" level="project" />
59+
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.3" level="project" />
60+
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.6" level="project" />
61+
<orderEntry type="library" name="Maven: com.google.guava:guava:17.0" level="project" />
6262
<orderEntry type="library" name="Maven: cglib:cglib:3.1" level="project" />
6363
<orderEntry type="library" name="Maven: org.ow2.asm:asm:4.2" level="project" />
6464
</component>
65-
</module>
66-
65+
</module>

src/main/java/io/appium/java_client/AppiumDriver.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ public AppiumDriver(URL remoteAddress, Capabilities desiredCapabilities) {
162162
.put(GET_SETTINGS, getC("/session/:sessionId/appium/settings"))
163163
.put(SET_SETTINGS, postC("/session/:sessionId/appium/settings"))
164164
.put(START_ACTIVITY,
165-
postC("/session/:sessionId/appium/device/start_activity"));
165+
postC("/session/:sessionId/appium/device/start_activity"))
166+
.put(TOGGLE_LOCATION_SERVICES, postC("/session/:sessionId/appium/device/toggle_location_services"));
167+
166168
ImmutableMap<String, CommandInfo> mobileCommands = builder.build();
167169

168170
HttpCommandExecutor mobileExecutor = new HttpCommandExecutor(

src/main/java/io/appium/java_client/MobileCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ public interface MobileCommand {
5252
String GET_SETTINGS = "getSettings";
5353
String SET_SETTINGS = "setSettings";
5454
String START_ACTIVITY = "startActivity";
55-
55+
String TOGGLE_LOCATION_SERVICES = "toggleLocationServices";
5656
}

src/main/java/io/appium/java_client/android/AndroidDriver.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ public boolean isLocked() {
218218
Response response = execute(IS_LOCKED);
219219
return Boolean.parseBoolean(response.getValue().toString());
220220
}
221+
222+
public void toggleLocationServices() {
223+
execute(TOGGLE_LOCATION_SERVICES);
224+
}
221225

222226
/**
223227
* Set the `ignoreUnimportantViews` setting. *Android-only method*

src/test/java/io/appium/java_client/android/AndroidDriverTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,9 @@ public void scrollToExactTest() {
169169
WebElement views = driver.findElementByAccessibilityId("Views");
170170
assertNotNull(views);
171171
}
172+
173+
@Test
174+
public void toggleLocationServicesTest() {
175+
driver.toggleLocationServices();
176+
}
172177
}

0 commit comments

Comments
 (0)