This folder contains a Python client-side Selenium sample for running a desktop browser test in BitBar Cloud.
bitbar_selenium.pycontains the sample unittest that opens the BitBar sample page, verifies the result text, and saves screenshots locally.Requirements.txtcontains the required Python package versions for this sample.screenshots/is created when the test runs and stores the captured images.
- Python 3
- Selenium for Python
- A valid BitBar API key
Install dependencies from Requirements.txt:
python3 -m pip install -r Requirements.txtIf your Python installation is managed by Homebrew and blocks global installs, use:
python3 -m pip install --break-system-packages --user -r Requirements.txtFor this sample to run without any code changes, use the package versions defined in Requirements.txt.
Then set your BitBar API key in the test capabilities in bitbar_selenium.py.
From this folder, run:
python3 bitbar_selenium.pySuccessful output looks like this:
Bitbar - Test Page for Samples
Bitbar
.
----------------------------------------------------------------------
Ran 1 test in 32.714s
OK
ModuleNotFoundError: No module named 'selenium'means Selenium is not installed for the Python interpreter you used to launch the test.SessionNotCreatedException: Full authentication is required to access this resourceusually means the BitBar API key is missing, invalid, or expired.TypeError: WebDriver.__init__() got an unexpected keyword argument 'desired_capabilities'means incompatible package versions are installed. Reinstall dependencies fromRequirements.txt.ValueError: Timeout value connect was <object object ...>usually meansurllib3is too new for this sample. Reinstall dependencies fromRequirements.txt.DeprecationWarningmessages from Selenium 3 internals can appear with newer Python versions and are non-blocking.- The sample saves screenshots into the local
screenshotsfolder in the current working directory.