Skip to content

Update the "SB" context manager and "Driver" manager for the latest changes #1582

@mdmintz

Description

@mdmintz

Update the "SB" context manager and "Driver" manager for the latest changes

The "SB" context manager and "Driver" manager have lots of options to keep up with the standard seleniumbase pytest options. They must be maintained to stay in sync.

For reference, here's an example of the SB context manager:

from seleniumbase import SB

with SB() as sb:  # Lots of args! (Eg. headless=True)
    sb.open("https://google.com/ncr")
    sb.type('[name="q"]', "SeleniumBase on GitHub\n")
    sb.click('a[href*="github.com/seleniumbase"]')
    sb.highlight("div.Layout-main")
    sb.highlight("div.Layout-sidebar")
    sb.sleep(0.5)

Here's the Driver Manager as a context manager:

from seleniumbase import Driver

with Driver(browser="chrome") as driver:
    driver.get("https://google.com/ncr")

Here's the Driver Manager as a direct import:

from seleniumbase import Driver

driver = Driver(browser="edge")
driver.get("https://google.com/ncr")

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions