πŸ“„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.

circle-info

pylenium.json is already created when using the pylenium init command

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

circle-info

You only need to change the values you care about.

If I only wanted to change the browser to be "firefox", then only include that:

Adding custom values

circle-info

You can add any objects within the custom object to be used by py.config

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:

circle-check

Then, use the --pylenium_json argument to pick which to use:

circle-info

You can name your custom Pylenium config files whatever you like, but they MUST be .json and have the same shape (aka schema) as the default pylenium.json

Last updated