centos7 安装selenium和firefox
之前有一篇文章介绍过在ubuntu下安装selenium和firefox
现在介绍下centos7
注意以下都是下载的linux64位的软件,32位的请自己找下链接,
现在使用的python的版本是3,请注意,2应该也可以运行
需要的版本有
firefox 57.0.4
cd /usr/local/firefox
wget https://download-ssl.firefox.com.cn/releases/firefox/57.0/zh-CN/Firefox-latest-x86_64.tar.bz2
tar -xjf Firefox-latest-x86_64.tar.bz2
接着建立软链接
ln -s /usr/local/firefox/firefox/firefox /usr/bin/firefox
这样firefox就下载完成
根据需要去官网下载
selenium 3.8.1
pip install selenium
geckodriver 0.19.1
wget https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz
tar -zxvf tar -zxvf geckodriver-v0.19.1-linux64.tar.gz
ln -s /xxx当前的路径/geckodriver /usr/bin/geckodriver
根据需要去官网下载
到这里基本完成了,可以在本地环境运行selenium
给个demo
#!/usr/bin/python3 from selenium import webdriver driver = webdriver.Firefox()
driver.get('https://www.baidu.com')
print(driver.title)
driver.quit()
以上firefox默认路径都是/usr/bin/firefox
如果要在Xshell上运行,还需要安装一些额外的东西
pyvirtualdisplay
pip install pyvirtualdisplay
以及xvfb
wget http://vault.centos.org/6.5/os/x86_64/Packages/xorg-x11-server-Xvfb-1.13.0-23.el6.centos.x86_64.rpm
yum localinstall xorg-x11-server-Xvfb-1.13.0-23.el6.centos.x86_64.rpm
到这里就结束了
最后给个demo
#!/usr/bin/python3 from selenium import webdriver
from pyvirtualdisplay import Display display = Display(visible=0, size=(800,600))
display.start()
driver = webdriver.Firefox()
driver.get('https://www.baidu.com')
print(driver.title)
driver.quit()
display.stop()
以上firefox默认路径都是/usr/bin/firefox
centos7 安装selenium和firefox的更多相关文章
- Ubuntu16.04/centos7 下为chrome/firefox安装flash player插件
为chrome安装flash: 打开终端,输入:sudo apt-get install pepperflashplugin-nonfree 或官网下载安装google-chrome-stable 为 ...
- windows下安装配置python + selenium 来驱动firefox
第一步,首先下载安装python ,我下载的是3.5版本,这个版本,自带了pip工具,不需要安装pip了 :) 链接地址:python 3.5 第二步,执行pip install selenium 安 ...
- Centos 7.6 安装selenium+firefox+google chrome(支持xshell运行)
1. 查看Linux 版本 [root@penguin selenium]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) ...
- selenium启动firefox时加载扩展
有些时候,我们测试需要用到插件或者已经导入的证书(比如金融和安全加密行业),而selenium启动firefox时会打开一个新的,不含有任何插件和个人证书的firefox(等同于全新安装后第一次打开的 ...
- 【Selenium】2.安装Selenium IDE和 FireBug
本文供学习交流之用,没有商业用途,没有盈利. 完全是我自己为督促自己学习而翻译的.翻译的不好,见谅.来源于:http://www.guru99.com/install-selenuim-ide.htm ...
- selenium和Firefox版本不兼容
selenium8.py coding = utf-8 from selenium import webdriver driver = webdriver.Firefox() driver.get(' ...
- ubuntu16.04 python3 安装selenium及环境配置
环境 ubuntu16.04 python3 安装selenium sudo pip3 install seleium 默认安装完是支持firefox,但是更新得太慢对于较新的firefox已经不支持 ...
- python中用selenium调Firefox报错问题
python在用selenium调Firefox时报错: Traceback (most recent call last): File "G:\python_work\chapter11 ...
- selenium启动Firefox失败
今天搭建java+selenium环境,搭建几次都失败,总结一下原因 1. selenium启动Firefox,不需要额外的driver 2. Friefox如果没有安装到默认路径C盘,代码中需要修改 ...
随机推荐
- Commons CLI 学习(1)
The Apache Commons CLI library provides an API for parsing command line options passed to programs. ...
- LeetCode解题报告—— Word Search & Subsets II & Decode Ways
1. Word Search Given a 2D board and a word, find if the word exists in the grid. The word can be con ...
- Raspberry Pi Finder
这是 meelo 原创的 玩转树莓派 系列文章 作为一名新手,你可能苦恼与如何寻找树莓派的IP地址.要想寻找IP地址,在不同的连接状况下,的方法是不一样的,这在其它教程里有作详细介绍(使用路由器连接树 ...
- requere.js优化js脚本加载方案,使用篇。
require.config({ paths: { "jquery": "jquery-3.2.1", 'index':"index" }} ...
- python 自定义过滤器
文件目录结构: 新建文件并且命名为“templatetags” , 然后复制 __init__.py文件,拷贝到templatetags文件夹里, __pycache__文件夹可以忽略哈,那是程序运行 ...
- LibreOJ #139 树链剖分 [树链剖分,线段树]
题目传送门 树链剖分 题目描述 这是一道模板题. 给定一棵 n 个节点的树,初始时该树的根为 1 号节点,每个节点有一个给定的权值.下面依次进行 m 个操作,操作分为如下五种类型: 换根:将一个指定的 ...
- Java面向对象和特征
面向对象: 概念: 面向对象是一种程序设计思想,计算机程序的设计实质上就是将现实中的一些事物的特征抽离出来描述成一些计算机事件的过程,这种抽象的过程中,我们把具体的事物封装成一个一个的整体进行描述,使 ...
- webstorm中.vue报错
1.webstorm中es6语法报错,解决方法: 打开 Settings => Languages & Frameworks => Javascript把 Javascript L ...
- 洛谷——P1113 杂务
P1113 杂务 题目描述 John的农场在给奶牛挤奶前有很多杂务要完成,每一项杂务都需要一定的时间来完成它.比如:他们要将奶牛集合起来,将他们赶进牛棚,为奶牛清洗乳房以及一些其它工作.尽早将所有杂务 ...
- Flask实战第47天:首页导航条首先和代码抽离
新建一个前台页面的父模板front_base.html 导航条是总boostrap v3中文站拷贝过来的,然后根据自己的需求做一些修改 <!DOCTYPE html> <html l ...