-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
1. Summary
It would be nice if SeleniumBase will support BrowserStack SDK with a new BrowserStack configuration file browserstack.yml
.
2. Legacy method
Currently, SeleniumBase solely supports the old, “legacy” BrowserStack integration method.
If I run my tests, use a command like this:
pytest tests/test_kira_example.py --browser=remote --server=BROWSERSTACK_USERNAME:BROWSERSTACK_KEY@hub.browserstack.com --demo --reuse-session --port=80 --cap_file=kira_capabilities.py
Tests run successfully on BrowserStack.
(One problem — when all tests are completed, the remote BrowserStack session continues. I need to set timeout duration in BrowserStack settings or write code like driver.quit()
especially for BrowserStack. I didn’t find in SeleniumBase an option like --close-remote-session-after-all-tests
.)
3. BrowserStack SDK
The BrowserStack SDK is a new BrowserStack solution that allows to run tests without having to write code for BrowserStack.
If we click on the link to BrowserStack capabilities in the SeleniumBase documentation, we see that BrowserStack offers by default the BrowserStack SDK, not Legacy integration method.
Currently, if I try to create a BrowserStack session with the browserstack.yml
file, SeleniumBase shows an error:
- --cap_file=kira_capabilities.py
+ --cap_file=browserstack.yml
C:\Python312\Lib\site-packages\seleniumbase\core\browser_launcher.py:1722: in get_remote_driver
desired_caps = capabilities_parser.get_desired_capabilities(cap_file)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cap_file = 'browserstack.yml'
def get_desired_capabilities(cap_file):
if cap_file.endswith(".py"):
capabilities = _parse_py_file(cap_file)
elif cap_file.endswith(".json"):
capabilities = _parse_json_file(cap_file)
else:
> raise Exception("\n\n`%s` is not a Python or JSON file!\n" % cap_file)
E Exception:
E
E `browserstack.yml` is not a Python or JSON file!
Thanks.