Selenium IDE: Install from chrome extension market or something like thatdocumentation: https://selenium-python.readthedocs.io/
pip install selenium
ChromeDriver: use exactly the same version with chrome browser.
If using macOS: brew install chromedriver
To authorize ChromeDriver: xattr -d com.apple.quarantine chromedriver
start your python script like following:
import selenium
from selenium import webdriver
driver = webdriver.Chrome(chromedriverPATH)
# no parameter if istall chromedriver with brew
driver.get('<https://www.tecmint.com>')
print(driver.title)
Selenium for headless:
def get_headless_driver(self):
"""
设置 Chrome header
"""
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--window-size=1980,1080')
options.add_argument('--disable-images')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--no-sandbox')
options.add_argument('--disable-gpu')
# TODO: install headless-chromium
options.binary_location = '/opt/bin/headless-chromium'
driver = webdriver.Chrome('/opt/bin/chromedriver', chrome_options=options)
return driver