Pylenium.io
GitHub ↗️
  • Welcome to Pylenium
  • Getting Started
    • 1. Virtual Environments
    • 2. Setup pytest
    • 3. Project Structure with pytest
    • 4. Writing Tests with Pylenium
  • Guides
    • πŸ“ŠVisualize Test Results with Allure
    • πŸ“Logging
    • 🟨Run Tests in Containers
    • πŸ”€Run Tests in Parallel
    • πŸ§ͺShould / Expected Conditions
    • 🌐Script with Standalone Pylenium
  • CLI
    • πŸ’»Pylenium CLI
    • πŸ“ŠAllure CLI
  • Configuration
    • πŸ“„pylenium.json
    • πŸš—Driver
    • πŸ–₯️Viewport
  • Fixtures
    • ↗️api
    • πŸͺ“axe
    • πŸ₯Έfake
    • βœ…py
    • β˜‘οΈpyc
    • ❌pys
  • Driver Commands
    • Overview
    • πŸ—ΊοΈNavigation
      • go
      • quit
      • reload
      • visit
    • πŸ”Find Elements
      • contains
      • find
      • findx
      • get
      • getx
    • ⏱️Driver.should()
    • 🌐Browser
      • execute_script
      • execute_async_script
      • maximize_window
      • screenshot
      • scroll_to
      • title
      • url
      • window_handles
      • window_size
      • viewport
    • πŸͺCookies
      • delete_all_cookies
      • delete_cookie
      • get_all_cookies
      • get_cookie
      • set_cookie
    • πŸ”„Switch To
      • default_content
      • frame
      • frame_by_element
      • parent_frame
      • window
      • new_window
      • new_tab
    • πŸ“ŠWeb Performance
      • Performance API
      • CDP Performance
    • fake
    • wait
    • webdriver
  • Element Commands
    • πŸ”Find Elements
    • ⏱️Element.should()
    • πŸ‘Actions
      • check
      • clear
      • click
      • deselect
      • double_click
      • drag_to
      • drag_to_element
      • focus
      • hover
      • right_click
      • scroll_into_view
      • select_by_index
      • select_by_text
      • select_by_value
      • submit
      • type
      • uncheck
      • upload
    • πŸ”’Element Data
      • css_value
      • get_attribute
      • get_property
      • tag_name
      • text
      • is_checked
      • is_displayed
      • is_enabled
      • is_selected
    • πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦Family
      • children
      • parent
      • siblings
    • open_shadow_dom
    • screenshot
    • webelement
  • Elements Commands
    • ⏱️Elements.should()
    • first
    • length
    • last
    • is_empty
  • Contribute
    • Clone and Setup the Project
Powered by GitBook
On this page
  • The Driver Settings
  • browser
  • remote_url
  • wait_time
  • page_load_wait_time
  • options
  • experimental_options
  • capabilities
  • extension_paths
  1. Configuration

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

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

Default is chrome

This is the browser name - "chrome" or "firefox" or "ie" or "safari" or "edge"

pylenium.json
"driver": {
    "browser": "firefox"
}
Terminal
pytest tests --browser=firefox

remote_url

Default is empty or""

This is used to connect to things like Selenium Grid.

pylenium.json
"driver": {
    "remote_url": "http://localhost:4444/wd/hub"
}
Terminal
pytest tests --remote_url="http://localhost:4444/wd/hub"

wait_time

Default is 10

The global number of seconds for actions to wait for.

pylenium.json
"driver": {
    "wait_time": 7
}
Terminal
You cannot set this from the command line

page_load_wait_time

Default is 0

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

Default is empty or []

A list of browser options to include when instantiating Pylenium.

pylenium.json
"driver": {
    "options": ["headless", "incognito"]
}
Terminal
pytest tests --options="headless, incognito"

experimental_options

Default is null or None

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

Default is empty or {}

A dictionary of the desired capabilities to include when instantiating Pylenium.

pylenium.json
{
    "driver": {
        "capabilities": {
            "enableVNC": true,
            "enableVideo": false,
            "name": "value"
        }
    }
}
Terminal
pytest tests --caps = '{"name": "value", "boolean": true}'

extension_paths

The list of extensions to be included when instantiating Pylenium.

Default is empty or []

{
    "driver": {
        "extension_paths": ["path_to_crx.crx", "other-path.crx"]
    }
}
Previouspylenium.jsonNextViewport

Last updated 11 months ago

Check out for an example of how to do this locally with Docker

πŸš—
Run Tests in Containers