File tree Expand file tree Collapse file tree
test/unit/webdriver/device Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515from typing import Dict , Union
1616
17- from selenium .common .exceptions import UnknownMethodException
1817from typing_extensions import Self
1918
2019from appium .protocols .webdriver .can_execute_commands import CanExecuteCommands
@@ -33,11 +32,7 @@ def toggle_location_services(self) -> Self:
3332 Returns:
3433 Union['WebDriver', 'Location']: Self instance
3534 """
36- try :
37- self .execute_script ('mobile: toggleGps' )
38- except UnknownMethodException :
39- # TODO: Remove the fallback
40- self .execute (Command .TOGGLE_LOCATION_SERVICES )
35+ self .execute_script ('mobile: toggleGps' )
4136 return self
4237
4338 def set_location (
@@ -89,10 +84,5 @@ def location(self) -> Dict[str, float]:
8984
9085 def _add_commands (self ) -> None :
9186 """Add location endpoints. They are not int w3c spec."""
92- self .command_executor .add_command (
93- Command .TOGGLE_LOCATION_SERVICES ,
94- 'POST' ,
95- '/session/$sessionId/appium/device/toggle_location_services' ,
96- )
9787 self .command_executor .add_command (Command .GET_LOCATION , 'GET' , '/session/$sessionId/location' )
9888 self .command_executor .add_command (Command .SET_LOCATION , 'POST' , '/session/$sessionId/location' )
Original file line number Diff line number Diff line change @@ -81,7 +81,6 @@ class MobileCommand:
8181 GET_SYSTEM_BARS = 'getSystemBars'
8282 GET_DISPLAY_DENSITY = 'getDisplayDensity'
8383 TOGGLE_WIFI = 'toggleWiFi'
84- TOGGLE_LOCATION_SERVICES = 'toggleLocationServices'
8584 GET_PERFORMANCE_DATA_TYPES = 'getPerformanceDataTypes'
8685 GET_PERFORMANCE_DATA = 'getPerformanceData'
8786 GET_NETWORK_CONNECTION = 'getNetworkConnection'
Original file line number Diff line number Diff line change @@ -24,10 +24,12 @@ class TestWebDriverLocation(object):
2424 @httpretty .activate
2525 def test_toggle_location_services (self ):
2626 driver = android_w3c_driver ()
27- httpretty .register_uri (httpretty .POST , appium_command ('/session/1234567890/appium/device/toggle_location_services' ))
2827 httpretty .register_uri (httpretty .POST , appium_command ('/session/1234567890/execute/sync' ))
2928 assert isinstance (driver .toggle_location_services (), WebDriver )
3029
30+ d = get_httpretty_request_body (httpretty .last_request ())
31+ assert d ['script' ] == 'mobile: toggleGps'
32+
3133 @httpretty .activate
3234 def test_set_location_float (self ):
3335 driver = android_w3c_driver ()
You can’t perform that action at this time.
0 commit comments