mirror of
https://github.com/tcsenpai/Zundler.git
synced 2025-06-06 11:35:40 +00:00
Use selenium fixture for all browsers
This commit is contained in:
parent
763c120413
commit
0fa98c1a51
@ -38,21 +38,25 @@ def is_responsive(port):
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def selenium_service(docker_ip, docker_services):
|
||||
def selenium_drivers(docker_ip, docker_services):
|
||||
# `port_for` takes a container port and returns the corresponding host port
|
||||
port = docker_services.port_for("firefox", 5900)
|
||||
drivers = {}
|
||||
|
||||
for browser in ["firefox"]:
|
||||
port = docker_services.port_for(browser, 5900)
|
||||
docker_services.wait_until_responsive(
|
||||
timeout=30.0, pause=0.1, check=lambda: is_responsive(port)
|
||||
)
|
||||
|
||||
options = webdriver.FirefoxOptions()
|
||||
driver = webdriver.Remote(
|
||||
command_executor='http://localhost:4444/wd/hub',
|
||||
drivers[browser] = webdriver.Remote(
|
||||
command_executor=f'http://localhost:4444/wd/hub',
|
||||
options=options,
|
||||
)
|
||||
|
||||
yield driver
|
||||
yield drivers
|
||||
|
||||
for browser, driver in drivers.items():
|
||||
driver.quit()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user