selenium安装
from selenium import webdriver
browser = webdriver.Chrome()
browser.get('https://www.baidu.com')
print browser.title
browser.quit()
网上找的一段验证代码 selenium 我是直接通过pycharm安装 也可以用pip3
webdriver安装
通过淘宝镜像下载比较快:https://npm.taobao.org/mirrors/chromedriver/?????
注意点: 要载与自己chrome浏览器版本一致的?
然后加到环境变量中
sudo mv ~/Downloads/chromedriver /usr/local/bin
验证是否安装成功
? ~ chromedriver
Starting ChromeDriver 98.0.4758.102 (273bf7ac8c909cde36982d27f66f3c70846a3718-refs/branch-heads/4758@{#1151}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
?最后再跑上面代码 看是否会打开chrome浏览器 会则成功
|