py

The main Pylenium fixture

Usage

The py fixture is the recommended way to use Pylenium because it gives each test its own instance of Pylenium which makes it easy to scale and parallelize.

from pylenium.driver import Pylenium

def test_element_should_be_visible(py: Pylenium):
    py.visit("https://demoqa.com/buttons")
    assert py.contains("Click Me").should().be_visible()

Arguments

  • none

Yields

  • Pylenium - an instance of Pylenium driver that interacts with the web

py_config

When using py, an instance of PyleniumConfig is also created and can be managed per test. You can access py_config as a fixture or directly from py.config

Access by Fixture

Recommended because it's fewer lines of code and you already have access via Pylenium

Last updated