

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) 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 To use use selenium, you need both the selenium module and the web driver installed. 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.
