centos7无GUI情况安装Xvfb、selenium、chrome
2018-09-07 14:55
1551 查看
centos7服务器无GUI情况下安装使用Xvfb、selenium、chrome和selenium-server
2016年10月31日15:24:24阅读数:12192更多个人分类:
</pre><pre>
最近需要用到selenium浏览器抓取,在windows下对照chrome浏览器开发的代码,在linux服务器上换成phantomjs驱动后,却不能运行了,通过截图发现phantomjs渲染效果和chrome不同。于是考虑在centos上安装chrome浏览器。
下面是做的一些记录。
1,centos7安装google-chrome
(1)添加chrome的repo源
vi/etc/yum.repos.d/google.repo[google]name=Google-x86_64baseurl=http://dl.google.com/linux/rpm/stable/x86_64enabled=1gpgcheck=0gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
(2)安装
yumupdate,然后yuminstallgoogle-chrome-stable这时候在非root账号下运行google-chrome会输出没有显示器,无法启动之类的。
不知道为什么不能在root账号下运行。
2,安装Xvfb
yumupdateyuminstallXvfb
yum-installlibXfont
yuminstallxorg-x11-fonts*
3,一个小测试
(1)安装selenium、pyvirtualdisplaypipinstallselenium
pipinstallpyvirtualdisplay
(2)下载chromedriver
从https://sites.google.com/a/chromium.org/chromedriver/home下载chromedriver
配置在PATH路径或者在脚本中指定路径
(3)demo
vimtest.py
期望输出百度首页的html文档。
4,seleniumserver
1,nohupXvfb-ac:7-screen01280x1024x8>/dev/null2>&1&2,exportDISPLAY=:7
3,java-jarselenium-server-standalone-3.0.1.jar
4,
相关文章推荐
- Centos7服务器无GUI情况下安装使用Xvfb+selenium+chrome
- centos7服务器无GUI情况下安装使用Xvfb、selenium、chrome和selenium-server
- 芝麻HTTP:在无GUI的CentOS上使用Selenium+Chrome
- Centos6.5 安装虚拟图形环境Xvfb及chrome
- centos 无界面安装selenium+chrome+chromedirver的设置
- 小白学爬虫-在无GUI的CentOS上使用Selenium+Chrome
- centos安装pip Xvfb Selenium
- [转载]CentOS 7安装Gnome GUI 图形界面
- CentOS 6.4 安装chrome
- ubuntu python3 安装selenium及chrome的环境配置
- 不重新编译PHP文件的情况下php GD库扩展库的编译安装(centos)
- 不重新编译PHP文件的情况下php GD库扩展库的编译安装(centos)
- Centos 6.4 下安装chrome提示 libstdc++.so.6问题的解决方案
- centos 6.x 安装 chrome
- Centos安装chrome
- CentOS7 安装 Chrome Stable
- Centos 6.5 安装 chrome , mplayer , alarm , clock
- CentOS安装Chrome及Please start Google Chrome as a normal user. To run as root, you must specify an ...
- CentOS 安装 Chrome
- selenium 安装与 chromedriver安装