access website with selenium webdriver[1]

1. download chromedriver.exe

from https://chromedriver.chromium.org/downloads
download chromedriver.exe match with your Chrome version

2. pip install selenium

then code test_selenium.py:

from selenium import webdriver

PATH = "C:\Program Files\chromedriver.exe"
driver = webdriver.Chrome(PATH)

driver.get("http://pythondesign.ca")
print(driver.title)
driver.quit()

3. testing

C:\Users\zhuby\hans>test_selenium.py
DevTools listening on ws://127.0.0.1:56440/devtools/browser/423ca555-35ae-46dc-8cfe-11925d381214
python design – explaining the world with python (zhuby1973@gmail.com)
you will get above info on console and the website opened in Chrome then closed.

Leave a Reply

Your email address will not be published. Required fields are marked *