Skip to content

Hello, I made a whole test case by importing Driver. Now I'm realizing I need methods from the BaseCase like .switch_to_window... How to resolve? #2347

Answered by mdmintz
disposablecarcass asked this question in Q&A
Discussion options

You must be logged in to vote

Look for any of the tests in the SeleniumBase/examples/ folder that start with raw_, as those are pure Python tests. (The tests start start with test_ or end with _test.py are tests that are meant to be run with pytest, and those tests have that special class structure that you've noticed.) Here are those raw_ tests:


For example, here's a script that imports Driver:

"""Driver() test. Runs with "python". (pytest not needed)."""
from seleniumbase import Driver

driver = Driver(browser="chrome", headless=False)
try:
    driver.open("seleniumbase.io/apps/calculator")
    driver.click('[id="4"]')
    driver.click('[id="2"]')
    driver.assert_text("42", "#output")
    driver.highlight("#output"

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@mdmintz
Comment options

@disposablecarcass
Comment options

@disposablecarcass
Comment options

@disposablecarcass
Comment options

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants