Skip to content

Commit cc3be93

Browse files
Merge branch temp into w3c
2 parents c35a552 + 543664a commit cc3be93

2 files changed

Lines changed: 20 additions & 18 deletions

File tree

android/browserstack_sample.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
from appium import webdriver
2+
from appium.options.android import UiAutomator2Options
23
from appium.webdriver.common.mobileby import MobileBy
34
from selenium.webdriver.support.ui import WebDriverWait
45
from selenium.webdriver.support import expected_conditions as EC
56
import time
67

7-
desired_cap = {
8-
# Set URL of the application under test
9-
"app" : "bs://<app-id>",
10-
8+
# Options are only available since client version 2.3.0
9+
# If you use an older client then switch to desired_capabilities
10+
# instead: https://github.com/appium/python-client/pull/720
11+
options = UiAutomator2Options().load_capabilities({
1112
# Specify device and os_version for testing
12-
"deviceName": "Google Pixel 3",
13-
"platformName": "android",
14-
"platformVersion": "9.0",
13+
"platformName" : "android",
14+
"platformVersion" : "9.0",
15+
"deviceName" : "Google Pixel 3",
16+
17+
# Set URL of the application under test
18+
"app" : "<bs://app-id>",
1519

1620
# Set other BrowserStack capabilities
17-
"bstack:options": {
18-
"userName" : "YOUR_USERNAME",
19-
"accessKey" : "YOUR_ACCESS_KEY",
21+
'bstack:options' : {
2022
"projectName" : "First Python project",
2123
"buildName" : "browserstack-build-1",
22-
"sessionName" : "first_test"
24+
"sessionName" : "first_test",
25+
26+
# Set your access credentials
27+
"userName" : "YOUR_USERNAME",
28+
"accessKey" : "YOUR_ACCESS_KEY"
2329
}
24-
}
30+
})
2531

2632
# Initialize the remote Webdriver using BrowserStack remote URL
2733
# and desired capabilities defined above
28-
driver = webdriver.Remote(
29-
command_executor="http://hub-cloud.browserstack.com/wd/hub",
30-
desired_capabilities=desired_cap
31-
)
34+
driver = webdriver.Remote("http://hub-cloud.browserstack.com/wd/hub", options=options)
3235

3336
# Test case for the BrowserStack sample Android app.
3437
# If you have uploaded your app, update the test case here.

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
Appium-Python-Client==0.52;python_version < '3.0'
2-
Appium-Python-Client==1.0.2;python_version >= '3.0'
1+
Appium-Python-Client==2.6.1;python_version >= '3.0'
32
browserstack-local==1.2.2

0 commit comments

Comments
 (0)