How to do the modern web automation with Selenium
1. install packages
!brew install --cask chromedriver
!pip install selenium
2. launch the chrome
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=5003 --user-data-dir="/Users/yingshaoxo/spiderChromeCache"
3. connect and rock
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option("debuggerAddress", "127.0.0.1:5003")
driver = webdriver.Chrome(options = options)
driver.get("https://baidu.com")
element = driver.find_element_by_xpath('//*[@id="kw"]')
element.send_keys("yingshaoxo\n")
4. author
yingshaoxo