Skip to content

Commit c35a552

Browse files
committed
Added w3c samples
1 parent 9623ca2 commit c35a552

File tree

4 files changed

+59
-46
lines changed

4 files changed

+59
-46
lines changed

android/browserstack_sample.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,45 @@
55
import time
66

77
desired_cap = {
8-
# Set your access credentials
9-
"browserstack.user" : "YOUR_USERNAME",
10-
"browserstack.key" : "YOUR_ACCESS_KEY",
11-
128
# Set URL of the application under test
139
"app" : "bs://<app-id>",
1410

1511
# Specify device and os_version for testing
16-
"device" : "Google Pixel 3",
17-
"os_version" : "9.0",
18-
12+
"deviceName": "Google Pixel 3",
13+
"platformName": "android",
14+
"platformVersion": "9.0",
15+
1916
# Set other BrowserStack capabilities
20-
"project" : "First Python project",
21-
"build" : "browserstack-build-1",
22-
"name" : "first_test"
17+
"bstack:options": {
18+
"userName" : "YOUR_USERNAME",
19+
"accessKey" : "YOUR_ACCESS_KEY",
20+
"projectName" : "First Python project",
21+
"buildName" : "browserstack-build-1",
22+
"sessionName" : "first_test"
23+
}
2324
}
2425

2526
# Initialize the remote Webdriver using BrowserStack remote URL
2627
# and desired capabilities defined above
2728
driver = webdriver.Remote(
28-
command_executor="http://hub-cloud.browserstack.com/wd/hub",
29+
command_executor="http://hub-cloud.browserstack.com/wd/hub",
2930
desired_capabilities=desired_cap
3031
)
3132

32-
# Test case for the BrowserStack sample Android app.
33-
# If you have uploaded your app, update the test case here.
33+
# Test case for the BrowserStack sample Android app.
34+
# If you have uploaded your app, update the test case here.
3435
search_element = WebDriverWait(driver, 30).until(
3536
EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Search Wikipedia"))
3637
)
3738
search_element.click()
3839
search_input = WebDriverWait(driver, 30).until(
39-
EC.element_to_be_clickable((MobileBy.ID, "org.wikipedia.alpha:id/search_src_text"))
40+
EC.element_to_be_clickable(
41+
(MobileBy.ID, "org.wikipedia.alpha:id/search_src_text"))
4042
)
4143
search_input.send_keys("BrowserStack")
4244
time.sleep(5)
4345
search_results = driver.find_elements_by_class_name("android.widget.TextView")
44-
assert(len(search_results) > 0)
46+
assert (len(search_results) > 0)
4547

4648
# Invoke driver.quit() after the test is done to indicate that the test is completed.
4749
driver.quit()

android/browserstack_sample_local.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,28 @@
1010
accessKey = "YOUR_ACCESS_KEY"
1111

1212
desired_caps = {
13-
"browserstack.user" : userName,
14-
"browserstack.key" : accessKey,
15-
1613
# Set URL of the application under test
17-
"app" : "<bs://app-id>",
14+
"app" : "bs://<app-id>",
1815

1916
# Specify device and os_version for testing
20-
"device" : "Google Pixel 3",
21-
"os_version" : "9.0",
22-
23-
#Set BrowserStack Local capability as True
24-
"browserstack.local": True,
17+
"deviceName": "Google Pixel 3",
18+
"platformName": "android",
19+
"platformVersion": "9.0",
2520

2621
# Set other BrowserStack capabilities
2722
"project" : "First Python Local project",
2823
"build" : "browserstack-build-1",
29-
"name" : "local_test"
24+
"name" : "local_test",
25+
26+
# Set other BrowserStack capabilities
27+
"bstack:options": {
28+
"userName" : userName,
29+
"accessKey" : accessKey,
30+
"projectName" : "First Python Local project",
31+
"buildName" : "browserstack-build-1",
32+
"sessionName" : "local_test",
33+
"local" : True
34+
}
3035
}
3136

3237
bs_local = None

ios/browserstack_sample.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@
55
import time
66

77
desired_cap = {
8-
# Set your access credentials
9-
"browserstack.user" : "YOUR_USERNAME",
10-
"browserstack.key" : "YOUR_ACCESS_KEY",
11-
128
# Set URL of the application under test
139
"app" : "bs://<app-id>",
1410

1511
# Specify device and os_version for testing
16-
"device" : "iPhone 11 Pro",
17-
"os_version" : "13",
18-
12+
"deviceName": "iPhone 11 Pro",
13+
"platformName": "ios",
14+
"platformVersion": "13",
15+
1916
# Set other BrowserStack capabilities
20-
"project" : "First Python project",
21-
"build" : "browserstack-build-1",
22-
"name" : "first_test"
17+
"bstack:options": {
18+
"userName" : "YOUR_USERNAME",
19+
"accessKey" : "YOUR_ACCESS_KEY",
20+
"projectName" : "First Python project",
21+
"buildName" : "browserstack-build-1",
22+
"sessionName" : "first_test"
23+
}
2324
}
2425

2526
# Initialize the remote Webdriver using BrowserStack remote URL

ios/browserstack_sample_local.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,28 @@
1010
accessKey = "YOUR_ACCESS_KEY"
1111

1212
desired_caps = {
13-
"browserstack.user" : userName,
14-
"browserstack.key" : accessKey,
15-
1613
# Set URL of the application under test
17-
"app" : "<bs://app-id>",
14+
"app" : "bs://<app-id>",
1815

1916
# Specify device and os_version for testing
20-
"device" : "iPhone 11 Pro",
21-
"os_version" : "13",
22-
23-
#Set BrowserStack Local capability as True
24-
"browserstack.local": True,
17+
"deviceName": "iPhone 11 Pro",
18+
"platformName": "ios",
19+
"platformVersion": "13",
2520

26-
# Set other BrowserStack capabilities
21+
# Set other BrowserStack capabilities
2722
"project" : "First Python Local project",
2823
"build" : "browserstack-build-1",
29-
"name" : "local_test"
24+
"name" : "local_test",
25+
26+
# Set other BrowserStack capabilities
27+
"bstack:options": {
28+
"userName" : userName,
29+
"accessKey" : accessKey,
30+
"projectName" : "First Python Local project",
31+
"buildName" : "browserstack-build-1",
32+
"sessionName" : "local_test",
33+
"local" : True
34+
}
3035
}
3136

3237
bs_local = None

0 commit comments

Comments
 (0)