Using helium - a Selenium API wrapper
Here is a quick example to use Helium.
Steps:
- Install dependencies using pip or add it to
requirements.txt
and runpip3 install -r requirements.txt
pip3 install helium
# or
pip3 install -r requirements.txt
- 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