
If everything went right, it will start the Chromium browser and open the python site. Save the program as example.py and run it with python3 example.py Options.binary_location = "/usr/bin/chromium"ĭriver = webdriver.Chrome(chrome_options=options) Options.add_argument( '-ignore-certificate-errors')

This also works for Edge from selenium.webdriver import EdgeĪfter installation of the web driver, we can make Python start the browser using the code below: If you use Chrome, you could do this: from selenium.webdriver import Chromeįor the Firefox driver, initialize like this: from selenium.webdriver import Firefox There are all kind of webdrivers including:ĭepending on which driver you install, you can load a different browser. This will install the selenium module, but that’s not all yet. Once that’s setup and activated, you want to install the selenium module inside it. To get started, first you should setup a virtual environment.

This can be quite tricky to get right, if you are new to selenium I recommend the course below.īrowser Automation with Python Selenium - Novice to Ninja Install selenium selenium-4.8.2.tar.gz), unarchive it, and run: python setup.py install Note: You may want to consider using virtualenv to create isolated Python environments. To use use selenium, you need both the selenium module and the web driver installed. Installing If you have pip on your system, you can simply install or upgrade the Python bindings: pip install -U selenium Alternately, you can download the source distribution from PyPI (e.g.

A web browser can be controlled using Python code, any task you would normally do on the web can be done using the selenium module.
