MCPcopy
hub / github.com/appium/python-client / android_w3c_driver

Function android_w3c_driver

test/unit/helper/test_helper.py:44–87  ·  view source on GitHub ↗

Return a W3C driver which is generated by a mock response for Android Returns: `webdriver.webdriver.WebDriver`: An instance of WebDriver

()

Source from the content-addressed store, hash-verified

42
43
44def android_w3c_driver() -> 'WebDriver':
45 """Return a W3C driver which is generated by a mock response for Android
46
47 Returns:
48 `webdriver.webdriver.WebDriver`: An instance of WebDriver
49 """
50
51 response_body_json = json.dumps(
52 {
53 'sessionId': '1234567890',
54 'capabilities': {
55 'platform': 'LINUX',
56 'desired': {
57 'platformName': 'Android',
58 'automationName': 'uiautomator2',
59 'platformVersion': '7.1.1',
60 'deviceName': 'Android Emulator',
61 'app': '/test/apps/ApiDemos-debug.apk',
62 },
63 'platformName': 'Android',
64 'automationName': 'uiautomator2',
65 'platformVersion': '7.1.1',
66 'deviceName': 'emulator-5554',
67 'app': '/test/apps/ApiDemos-debug.apk',
68 'deviceUDID': 'emulator-5554',
69 'appPackage': 'io.appium.android.apis',
70 'appWaitPackage': 'io.appium.android.apis',
71 'appActivity': 'io.appium.android.apis.ApiDemos',
72 'appWaitActivity': 'io.appium.android.apis.ApiDemos',
73 },
74 }
75 )
76
77 httpretty.register_uri(httpretty.POST, appium_command('/session'), body=response_body_json)
78
79 desired_caps = {
80 'platformName': 'Android',
81 'deviceName': 'Android Emulator',
82 'app': 'path/to/app',
83 'automationName': 'UIAutomator2',
84 }
85
86 driver = webdriver.Remote(SERVER_URL_BASE, options=UiAutomator2Options().load_capabilities(desired_caps))
87 return driver
88
89
90def ios_w3c_driver() -> 'WebDriver':

Calls 3

UiAutomator2OptionsClass · 0.90
appium_commandFunction · 0.85
load_capabilitiesMethod · 0.80

Tested by

no test coverage detected