Home > AI > Testing > Selenium >

intro

The simplest code:

from selenium import webdriver\
driver = webdriver.Chrome('/Users/dph/Downloads/chromedriver')
driver.get("https://www.python.org")
print(driver.title)

Firstly, you need to install selenium pip install selenium

Secondly, you need to download the chromedrive and pass the path to the driver. https://chromedriver.storage.googleapis.com/index.html?path=90.0.4430.24/

Thirdly, Apple may alert the chromedriver is from internet and not safe. You can use this method on command line.

/usr/local/Caskroom/chromedriver (your driver path)
$ xattr -d com.apple.quarantine chromedriver 

Finally, if you see the webpage is opened and the title is printed, then means the selenium can work.

Leave a Reply