- Python, PIP installed
- Chrome webbrowser installed
-
Download WebDriver for approriate Chrome version from here
-
Copy the executable to
C:\WebDriver\bin
-
Add the WebDriver location to
PATH
(usingcmd.exe
):setx /m path "%path%;C:\WebDriver\bin\"
-
Install Selenium with PIP (also using
cmd.exe
):pip install selenium
Test if everything worked in Python console:
from selenium import webdriver
# Instantiate driver (opens browser)
driver = webdriver.Chrome('C:\\WebDriver\\bin\\chromedriver.exe')
# Open a website
driver.get('http://www.google.com/');
# Execute javascript
driver.execute_script("javascript:alert('hi!');")
# Close browser
driver.quit()