Selenium containers

Allows to spin up selenium containers for testing with browsers.

class testcontainers.selenium.BrowserWebDriverContainer(capabilities, image=None, **kwargs)

Selenium browser container for Chrome or Firefox.

Example

from selenium.webdriver import DesiredCapabilities

with BrowserWebDriverContainer(DesiredCapabilities.CHROME) as chrome:
    webdriver = chrome.get_driver()
    webdriver.get("http://google.com")
    webdriver.find_element("name", "q").send_keys("Hello")

You can easily change browser by passing DesiredCapabilities.FIREFOX instead.