πpylenium.json
The configuration file for Pylenium
Configure with a JSON File
If you don't want to use Pylenium's defaults but you don't want to configure it via the CLI, you can create a pylenium.json file at the Project Root (same directory as our conftest.py file) and do it with a JSON instead.
Here are all of the current settings (and their defaults) you can configure right now:
{
"driver": {
"browser": "chrome",
"remote_url": "",
"wait_time": 10,
"page_load_wait_time": 0,
"options": [],
"capabilities": {},
"experimental_options": null,
"extension_paths": [],
"webdriver_kwargs": {},
"local_path": ""
},
"logging": {
"screenshots_on": true
},
"viewport": {
"maximize": true,
"width": 1440,
"height": 900,
"orientation": "portrait"
},
"custom": {}
}
Change a single value
If I only wanted to change the browser to be "firefox", then only include that:
Adding custom values
Adding your own key/value pairs is easy:
Now you can use it like any other dictionary in Python:
Complex custom objects
More complex or nested objects are easy to add as well:
It's still just a Python dictionary, so you can easily access them:
Multiple Versions
You can have multiple pylenium.json files and pick which one to use when executing tests.
For example, you can have multiple at your Project Root:
or store them in another folder:
Keep the original pylenium.json at the Project Root so the default behavior continues to work π
Then, use the --pylenium_json argument to pick which to use:
Last updated