Skip to content

Commit f008a0c

Browse files
agarneha1331francisf
authored andcommitted
Corrections
1 parent deeee59 commit f008a0c

8 files changed

+110
-14
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please
7474
7575
Open `Android` or `iOS` folder :
7676
77-
- If you have uploaded your own app, update the app in the `browserstack.yml`
77+
- If you have uploaded your own app, update the app id or directly upload the path to your app in the `browserstack.yml`
7878
7979
- Run `browserstack-sdk python browserstack_sample.py`
8080
@@ -102,9 +102,9 @@ Ensure that @ symbol is prepended to the file path in the above request. Please
102102
103103
Open `Android` or `iOS` folder :
104104
105-
- Ensure that `local` capability is set to `true` in the `browserstack.yml` file
105+
- Ensure that `browserstackLocal` capability is set to `true` in the `browserstack.yml` file
106106
107-
- If you have uploaded your own app, update the app in the `browserstack.yml`
107+
- If you have uploaded your own app, update the app capability with the app id or directly upload the path to your app in the `browserstack.yml`
108108
109109
- Run `browserstack-sdk python browserstack_sample_local.py`
110110

android/browserstack.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${
2323

2424
source: 'python:appium-sample-sdk:v1.0'
2525

26+
# Set `app` to define the app that is to be used for testing.
27+
# It can either take the id of any uploaded app or the path of the app directly.
2628
app: ./WikipediaSample.apk
2729
# app: ./LocalSample.apk #For running local tests
2830

@@ -52,7 +54,7 @@ platforms:
5254
# Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack
5355
#
5456
# Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack
55-
# parallelsPerPlatform: 1
57+
parallelsPerPlatform: 1
5658

5759
# ==========================================
5860
# BrowserStack Local

android/browserstack_sample.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,29 @@
55
from selenium.webdriver.support import expected_conditions as EC
66
import time
77

8+
options = UiAutomator2Options().load_capabilities({
9+
# Specify device and os_version for testing
10+
"platformName" : "android",
11+
"platformVersion" : "9.0",
12+
"deviceName" : "Google Pixel 3",
13+
14+
# Set URL of the application under test
15+
"app" : "bs://<app-id>",
16+
17+
# Set other BrowserStack capabilities
18+
'bstack:options' : {
19+
"projectName" : "BrowserStack Samples",
20+
"buildName" : "browserstack build",
21+
"sessionName" : "BStack sample python-appium",
22+
23+
# Set your access credentials
24+
"userName" : "YOUR_USERNAME",
25+
"accessKey" : "YOUR_ACCESS_KEY"
26+
}
27+
})
28+
829
# Initialize the remote Webdriver using BrowserStack remote URL
9-
driver = webdriver.Remote("http://hub.browserstack.com/wd/hub")
30+
driver = webdriver.Remote("http://localhost:4444/wd/hub", options=options)
1031

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

android/browserstack_sample_local.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,35 @@
33
from appium.webdriver.common.appiumby import AppiumBy
44
from selenium.webdriver.support.ui import WebDriverWait
55
from selenium.webdriver.support import expected_conditions as EC
6-
from browserstack.local import Local
76
import time
87

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+
933
# 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)
1135

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

ios/browserstack.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${
2323

2424
source: 'python:appium-sample-sdk:v1.0'
2525

26-
# app: ./BStackSampleApp.ipa
27-
app: ./LocalSample.ipa #For running local tests
26+
# Set `app` to define the app that is to be used for testing.
27+
# It can either take the id of any uploaded app or the path of the app directly.
28+
app: ./BStackSampleApp.ipa
29+
# app: ./LocalSample.ipa #For running local tests
2830

2931
# =======================================
3032
# Platforms (Browsers / Devices to test)

ios/browserstack_sample.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,32 @@
55
from selenium.webdriver.support import expected_conditions as EC
66
import time
77

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 = XCUITestOptions().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": "iPhone 11 Pro",
17+
"platformName": "ios",
18+
"platformVersion": "13",
19+
20+
# Set other BrowserStack capabilities
21+
"bstack:options": {
22+
"projectName" : "BrowserStack Samples",
23+
"buildName" : "browserstack build",
24+
"sessionName" : "BStack sample python-appium",
25+
26+
# Set your access credentials
27+
"userName" : "YOUR_USERNAME",
28+
"accessKey" : "YOUR_ACCESS_KEY"
29+
}
30+
})
31+
832
# Initialize the remote Webdriver using BrowserStack remote URL
9-
driver = webdriver.Remote("http://hub.browserstack.com/wd/hub")
33+
driver = webdriver.Remote("http://localhost:4444/wd/hub", options=options)
1034

1135
# Test case for the BrowserStack sample iOS app.
1236
# If you have uploaded your app, update the test case here.

ios/browserstack_sample_local.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,35 @@
33
from appium.webdriver.common.appiumby import AppiumBy
44
from selenium.webdriver.support.ui import WebDriverWait
55
from selenium.webdriver.support import expected_conditions as EC
6-
from browserstack.local import Local
76
import os
87

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 = XCUITestOptions().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": "iPhone XS",
17+
"platformName": "ios",
18+
"platformVersion": "12",
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+
933
# 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)
1135

1236
# Test case for the BrowserStack sample iOS app.
1337
# 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 @@
11
Appium-Python-Client==2.6.1;python_version >= '3.0'
2-
browserstack-local==1.2.2
3-
browserstack-sdk==1.4.0
2+
browserstack-sdk

0 commit comments

Comments
 (0)