🚗Driver
Configure the driver via the pylenium.json or the CLI.
The Driver Settings
Supported Drivers:
Chrome
Edge
Safari
Firefox
Internet Explorer
Let's take a look at the Driver Settings in pylenium.json
"driver": {
"browser": "chrome",
"remote_url": "",
"wait_time": 10,
"page_load_wait_time": 0,
"options": [],
"capabilities": {},
"experimental_options": null,
"extension_paths": [],
"webdriver_kwargs": {},
"local_path": ""
}Let's break each one of these down so you know what they are for and how you can configure them.
browser
This is the browser name - "chrome" or "firefox" or "ie" or "safari" or "edge"
"driver": {
"browser": "firefox"
}pytest tests --browser=firefoxremote_url
This is used to connect to things like Selenium Grid.
Check out Run Tests in Containers for an example of how to do this locally with Docker
"driver": {
"remote_url": "http://localhost:4444/wd/hub"
}pytest tests --remote_url="http://localhost:4444/wd/hub"wait_time
The global number of seconds for actions to wait for.
"driver": {
"wait_time": 7
}You cannot set this from the command linepage_load_wait_time
The amount of time to wait for the page to load before raising an error.
# set it globally in CLI
--page_load_wait_time 10// set it globally in pylenium.json
{
"driver": {
"page_load_wait_time": 10
}
}# override the global page_load_wait_time just for the current test
py.set_page_load_timeout(10)options
A list of browser options to include when instantiating Pylenium.
"driver": {
"options": ["headless", "incognito"]
}pytest tests --options="headless, incognito"experimental_options
A list of experimental options to include in the driver. These can only be added using pylenium.json
{
"experimental_options": [
{"useAutomationExtension": false},
{"otherName": "value"}
]
}capabilities
A dictionary of the desired capabilities to include when instantiating Pylenium.
{
"driver": {
"capabilities": {
"enableVNC": true,
"enableVideo": false,
"name": "value"
}
}
}pytest tests --caps = '{"name": "value", "boolean": true}'extension_paths
The list of extensions to be included when instantiating Pylenium.
{
"driver": {
"extension_paths": ["path_to_crx.crx", "other-path.crx"]
}
}Last updated