browserist
- The belief that web browsers account for differences in websites or web applications in all of their ability and that a particular web browser is superior to others.
- Discrimination or prejudice based on web browser.
Despite the urban definition, Browserist is a Python extension of the Selenium web driver that makes it even easier to use different browsers for testing and automation.
With Browserist as an extension to Selenium, you get:
- Improved stability and speed
- Simple syntax and less code
- Hassle-free setup across browsers: Chrome, Firefox, Edge, Safari, Internet Explorer
- Extensive framework of functions that makes browser automation easy
- Efficient development workflow with IntelliSense and type hints
Ready to try? With PyPI:
pip install browserist
Or with Homebrew:
brew tap jakob-bagterp/browserist
brew install browserist
Find more installation details here.
You're now ready to go:
from browserist import Browser
with Browser() as browser:
browser.open.url("https://example.com")
browser.wait.seconds(5)
Browserist improves stability with less code compared to standard use of Selenium. As browsers need time to render web pages, especially single-page applications, Selenium is often used with explicit timeouts:
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://example.com")
driver.implicitly_wait(3)
search_box = driver.find_element(By.XPATH, "//xpath/to/input")
search_button = driver.find_element(By.XPATH, "//xpath/to/button")
search_box.send_keys("Lorem ipsum")
search_button.click()
driver.quit()
Browserist does the same with less and cleaner code, yet also with increased stability and without explicit/implicit waits:
from browserist import Browser
with Browser() as browser:
browser.open.url("https://example.com")
browser.input.value("//xpath/to/input", "Lorem ipsum")
browser.click.button("//xpath/to/button")
Find tutorials, code examples, list of all methods and much more here.
This module is free to use. And if you like it, feel free to sponsor the project.
If you have suggestions or changes to the module, feel free to add to the code and create a pull request.
Report bugs and issues here.