linux---centos7 安装chromedriver
2024-10-15 07:55:02
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
最新文章
- Molile App(HTTP/HTML)—Record and Analyze Traffic
- org.springframework.beans.MutablePropertyValues.add
- noip 模拟赛 匹配 //贪婪策略
- 10、WGET
- 优化win2d实现的萤火虫粒子效果
- KnockOutJS步步深入
- 学习Shell脚本编程(第2期)_编写修改权限及执行Shell程序的步骤
- YZM的全排列
- 深度信任网络的快速学习算法(Hinton的论文)
- SPRING IN ACTION 第4版笔记-第十一章Persisting data with object-relational mapping-002设置JPA的EntityManagerFactory(<;persistence-unit>;、<;jee:jndi-lookup>;)
- android:layout_weight属性的简单使用
- 图解Http协议 (转)
- 关于开发环境中的消息在download时没有下载下来时的问题
- 关于 HashTable
- Oracle lag()/lead() over()分析函数
- PTA编程总结3—抓老鼠啊~亏了还是赚了?
- js-倒计时应用
- mongo源码学习(三)请求接收传输层
- cxGrid数据录入
- 2018-2019-2 网络对抗技术 20165202 Exp5 MSF基础应用
热门文章
- 给自己的小练习19-[kuangbin带你飞]专题九连通图
- 洛谷P4606 [SDOI2018]战略游戏 【圆方树 + 虚树】
- 【Python简介】
- 03-树3. Tree Traversals Again (25)将先序遍历和中序遍历转为后序遍历
- Codeforces 894.C Marco and GCD Sequence
- 微信JSSDK权限签名申请
- 前端PHP入门-024-字符串函数-API查看
- 使用RVM轻松部署Ruby环境
- Codeforces Round #191 (Div. 2) B. Hungry Sequence(素数筛选法)
- React Native 入门笔记一 -- Windows下基本环境配置