Skip to content

Commit 0518ca6

Browse files
Merge pull request #11 from karanshah-browserstack/add_source_caps
Adding source capability and modifying session name
2 parents f9b504e + 9d10d56 commit 0518ca6

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

scripts/local.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
"os" : "OS X",
3030
"osVersion" : "Sierra",
3131
"buildName" : "browserstack-build-1",
32-
"sessionName" : "BStack Python sample local",
32+
"sessionName" : "BStack local python",
3333
"local" : "true",
3434
"userName": BROWSERSTACK_USERNAME,
3535
"accessKey": BROWSERSTACK_ACCESS_KEY
3636
}
37-
37+
desired_cap["source"] = "python:sample-main:v1.0"
3838
options = ChromeOptions()
3939
options.set_capability('bstack:options', desired_cap)
4040
driver = webdriver.Remote(

scripts/parallel.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@
2121
"os": "OS X",
2222
"osVersion": "Monterey",
2323
"buildName" : "browserstack-build-1",
24-
"sessionName" : "BStack Python sample parallel",
24+
"sessionName" : "BStack parallel python",
2525
"browserName": "chrome",
2626
"browserVersion": "latest"
2727
},
2828
{
2929
"os": "Windows",
3030
"osVersion": "11",
3131
"buildName" : "browserstack-build-1",
32-
"sessionName" : "BStack Python sample parallel",
32+
"sessionName" : "BStack parallel python",
3333
"browserName": "firefox",
3434
"browserVersion": "latest"
3535
},
3636
{
3737
"osVersion": "10",
3838
"deviceName" : "Samsung Galaxy S20",
3939
"buildName" : "browserstack-build-1",
40-
"sessionName" : "BStack Python sample parallel",
40+
"sessionName" : "BStack parallel python",
4141
"browserName": "chrome",
4242
},
4343
]
@@ -61,7 +61,7 @@ def run_session(cap):
6161
}
6262
if "os" in cap:
6363
bstack_options["os"] = cap["os"]
64-
64+
bstack_options["source"] = "python:sample-main:v1.0"
6565
options = get_browser_option(cap["browserName"].lower())
6666
if "browserVersion" in cap:
6767
options.browser_version = cap["browserVersion"]
@@ -90,14 +90,14 @@ def run_session(cap):
9090
# Set the status of test as 'passed' or 'failed' based on the condition; if item is added to cart
9191
driver.execute_script(
9292
'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed", "reason": "iPhone 12 has been successfully added to the cart!"}}')
93-
except NoSuchElementException as err:
94-
message = "Exception: " + str(err.__class__) + str(err.msg)
95-
driver.execute_script(
96-
'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed", "reason": ' + json.dumps(message) + '}}')
97-
except Exception as err:
98-
message = "Exception: " + str(err.__class__) + str(err.msg)
99-
driver.execute_script(
100-
'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed", "reason": ' + json.dumps(message) + '}}')
93+
except NoSuchElementException as err:
94+
message = "Exception: " + str(err.__class__) + str(err.msg)
95+
driver.execute_script(
96+
'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed", "reason": ' + json.dumps(message) + '}}')
97+
except Exception as err:
98+
message = "Exception: " + str(err.__class__) + str(err.msg)
99+
driver.execute_script(
100+
'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed", "reason": ' + json.dumps(message) + '}}')
101101
# Stop the driver
102102
driver.quit()
103103

scripts/single.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
"os" : "OS X",
1818
"osVersion" : "Monterey",
1919
"buildName" : "browserstack-build-1",
20-
"sessionName" : "BStack Python sample",
20+
"sessionName" : "BStack single python",
2121
"userName": BROWSERSTACK_USERNAME,
2222
"accessKey": BROWSERSTACK_ACCESS_KEY
2323
}
24-
24+
bstack_options["source"] = "python:sample-main:v1.0"
2525
options = ChromeOptions()
2626
options.set_capability('bstack:options', bstack_options)
2727
driver = webdriver.Remote(

0 commit comments

Comments
 (0)