|
3 | 3 | from appium.webdriver.common.appiumby import AppiumBy |
4 | 4 | from selenium.webdriver.support.ui import WebDriverWait |
5 | 5 | from selenium.webdriver.support import expected_conditions as EC |
6 | | -from browserstack.local import Local |
7 | 6 | import time |
8 | 7 |
|
| 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({ |
| 12 | + # Set URL of the application under test |
| 13 | + "app" : "bs://<app-id>", |
| 14 | + |
| 15 | + # Specify device and os_version for testing |
| 16 | + "deviceName": "Google Pixel 3", |
| 17 | + "platformName": "android", |
| 18 | + "platformVersion": "9.0", |
| 19 | + |
| 20 | + # Set other BrowserStack capabilities |
| 21 | + "bstack:options": { |
| 22 | + "projectName" : "BrowserStack Samples", |
| 23 | + "buildName" : "browserstack build", |
| 24 | + "sessionName" : "BStack local python-appium", |
| 25 | + "local" : "true", |
| 26 | + |
| 27 | + # Set your access credentials |
| 28 | + "userName" : "YOUR_USERNAME", |
| 29 | + "accessKey" : "YOUR_ACCESS_KEY" |
| 30 | + } |
| 31 | +}) |
| 32 | + |
9 | 33 | # Initialize the remote Webdriver using BrowserStack remote URL |
10 | | -driver = webdriver.Remote("http://hub.browserstack.com/wd/hub") |
| 34 | +driver = webdriver.Remote("http://localhost:4444/wd/hub", options=options) |
11 | 35 |
|
12 | 36 | # Test case for the BrowserStack sample Android app. |
13 | 37 | # If you have uploaded your app, update the test case here. |
|
0 commit comments