Using helium - a Selenium API wrapper

Here is a quick example to use Helium.

Helium

Steps:

  1. Install dependencies using pip or add it to requirements.txt and run pip3 install -r requirements.txt
pip3 install helium
# or
pip3 install -r requirements.txt
  1. Create a python file and paste the following code.
#!/usr/bin/env python3
"""
Demonstrates how to use helium to automate a web browser.
"""
from helium import start_firefox

def main():
    driver = start_firefox()
    driver.execute_script("window.alert('Hello World')")


if __name__ == "__main__":
    main()

Here I’m using Firefox but it is easy to switch to Chrome.

References:

Github | Documentation | ⭐⭐⭐ Cheat sheet