1.安装浏览器

指定yum 源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

安装

curl https://intoli.com/install-google-chrome.sh | bash

ldd /opt/google/chrome/chrome | grep "not found"

安装后,执行:google-chrome-stable --no-sandbox --headless --disable-gpu --screenshot https://www.baidu.com/

报这个错误?我猜想是没有UI界面的原因,到这里可以判断安装成功。

2. 安装chromedriver

下载:https://npm.taobao.org/mirrors/chromedriver/

unzip 解压

安装完成

建立软连接:

ln -s /opt/google/chromedriver /usr/bin/chromedriver

3.测试:

#coding=utf8
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
driver = webdriver.Chrome(chrome_options=chrome_options)
#driver = webdriver.Chrome()
driver.get("https://www.baidu.com") print(driver.page_source)
#driver.quit()

到这里ok

最新文章

  1. Molile App(HTTP/HTML)—Record and Analyze Traffic
  2. org.springframework.beans.MutablePropertyValues.add
  3. noip 模拟赛 匹配 //贪婪策略
  4. 10、WGET
  5. 优化win2d实现的萤火虫粒子效果
  6. KnockOutJS步步深入
  7. 学习Shell脚本编程(第2期)_编写修改权限及执行Shell程序的步骤
  8. YZM的全排列
  9. 深度信任网络的快速学习算法(Hinton的论文)
  10. SPRING IN ACTION 第4版笔记-第十一章Persisting data with object-relational mapping-002设置JPA的EntityManagerFactory(<persistence-unit>、<jee:jndi-lookup>)
  11. android:layout_weight属性的简单使用
  12. 图解Http协议 (转)
  13. 关于开发环境中的消息在download时没有下载下来时的问题
  14. 关于 HashTable
  15. Oracle lag()/lead() over()分析函数
  16. PTA编程总结3—抓老鼠啊~亏了还是赚了?
  17. js-倒计时应用
  18. mongo源码学习(三)请求接收传输层
  19. cxGrid数据录入
  20. 2018-2019-2 网络对抗技术 20165202 Exp5 MSF基础应用

热门文章

  1. 给自己的小练习19-[kuangbin带你飞]专题九连通图
  2. 洛谷P4606 [SDOI2018]战略游戏 【圆方树 + 虚树】
  3. 【Python简介】
  4. 03-树3. Tree Traversals Again (25)将先序遍历和中序遍历转为后序遍历
  5. Codeforces 894.C Marco and GCD Sequence
  6. 微信JSSDK权限签名申请
  7. 前端PHP入门-024-字符串函数-API查看
  8. 使用RVM轻松部署Ruby环境
  9. Codeforces Round #191 (Div. 2) B. Hungry Sequence(素数筛选法)
  10. React Native 入门笔记一 -- Windows下基本环境配置