Python--安装与配置selenium
来源:互联网 发布:淘宝颜色分类自定义 编辑:程序博客网 时间:2024/06/10 20:39
安装及使用的中文文档可以在这里找到readthedocs.io
安装
# pip install selenium
配置
下载驱动
selenium3.x以上需要浏览器驱动,到这里下载相应驱动,https://github.com/SeleniumHQ/selenium/blob/master/py/docs/source/index.rst
解压
解压驱动到/usr/bin
或/usr/local/bin
测试
运行下面代码,测试是否能正常使用
from selenium import webdriverfrom selenium.webdriver.common.keys import Keysdriver = webdriver.Firefox()driver.get('https://www.baidu.com')assert 'Python' in driver.titleelem = driver.find_element_by_name('q')elem.send_keys('pycon')elem.send_keys(Keys.RETURN)assert 'No results found.' not in driver.page_source# driver.close()
问题
No such file or directory: 'geckodriver'
没有装上驱动,或没有放到指定位置
Message: can not connect to the service geckodriver
可能是没有localhost,打开/etc/hosts
,看里面有没有这样一句 127.0.0.1 localhost
没有就加上
阅读全文
0 0
- Python--安装与配置selenium
- Ubuntu python安装与配置selenium
- python+selenium 安装配置
- python+selenium安装配置教程
- Python pip selenium安装配置
- Python库selenium的安装与使用
- 【Selenium】selenium安装与配置,以及chromedriver的使用
- python+selenium配置
- selenium+python 环境配置
- Python Selenium环境配置
- python安装与配置
- 安装python+selenium
- Python安装基础+selenium
- python selenium安装
- Python+selenium环境安装
- python 安装selenium环境
- selenium-python安装
- Python安装Selenium
- 这可能是史上最全的CSS自适应布局总结
- Android 故障GIF动画制作
- Java Web基础知识之Servlet(3):Session管理
- Java内存区域
- 8款最好用的Java集成开发工具(IDE)
- Python--安装与配置selenium
- gcc编译基本用法
- Android Studio环境下连接远程服务器中的sqlserver2012数据库方法
- Velocity缓存与穿透(转)
- 利用Canvas+js编写贪吃蛇游戏
- Most of the shadows of life are caused by standing in our own sunshine.
- [TJOI2010]中位数(优先队列,堆)
- 几个学习Shell的不错链接
- linux内核函数schedule()实现进程的调度