Python 3.7.6

 1.安装selenium

pip install selenium

2.根据自己的chrome版本下载相应版本的chromedriver

http://npm.taobao.org/mirrors/chromedriver/

3.把chromedriver解压后拷贝到PATH

cp ~/Downloads/chromedriver /usr/local/bin

4.openbaidu.py

#!usr/bin/python

from selenium import webdriver
import time

browser = webdriver.Chrome()
browser.get("http://www.baidu.com")
browser.find_element_by_id("kw").send_keys("selenium")
browser.find_element_by_id("su").click()
time.sleep(5)
browser.quit()

5.

python openbaidu.py

mac 搭建python+selenium+chromedriver环境 

http://npm.taobao.org/mirrors/chromedriver/

3.把chromedriver解压后拷贝到PATH

cp ~/Downloads/chromedriver /usr/local/bin

4.openbaidu.py

相关文章:

  • 2021-05-30
  • 2021-09-08
  • 2021-10-21
  • 2021-06-21
  • 2021-11-02
  • 2021-08-11
  • 2021-11-28
猜你喜欢
  • 2022-02-09
  • 2022-01-18
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案