安装

pip install selenium 或者到https://pypi.python.org/pypi/selenium 下载setup安装包,之后进入目录后运行python setup.py install

官方文档

官方文档地址:http://selenium-python.readthedocs.io/installation.html

安装驱动

需要下载相应浏览器的驱动,驱动下载地址:http://docs.seleniumhq.org/download/

把geckodriver.exe放置到Python的目录,也把驱动放到Firefox的安装目录,并把Firefox的路径添加到系统环境变量path

#!/usr/bin/env python
# -*- coding: utf-8 -*- import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys class PythonOrgSearch(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox() def test_search_in_python_org(self):
driver = self.driver
driver.get("http://www.python.org")
self.assertIn("Python", driver.title)
elem = driver.find_element_by_name("q")
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source def tearDown(self):
self.driver.close() if __name__ == "__main__":
unittest.main()

参考:

https://www.cnblogs.com/gopythoner/p/7735379.html

http://blog.csdn.net/nhudx061/article/details/43601065/

http://selenium-python.readthedocs.io/installation.html

https://www.cnblogs.com/fnng/p/3325300.html

http://www.51testing.com/zhuanti/selenium.html

http://blog.csdn.net/blueheart20/article/details/70768930

https://www.cnblogs.com/fnng/archive/2013/05/29/3106515.html

https://github.com/mozilla/geckodriver/releases

https://www.zhihu.com/question/49568096

python selenium 模块的安装及使用的更多相关文章

  1. python selenium模块调用浏览器的时候出错

    python selenium模块使用出错,这个怎么改 因为不同版本更新不同步问题,浏览器都要另外下一个驱动.

  2. Selenium模块的安装

    Selenium模块 1.安装selenium python2:pip install selenium python3:pip install selenium 2.设置浏览器驱动 解压后必须与浏览 ...

  3. python部分模块的安装

    scrapy http://www.cnblogs.com/txw1958/archive/2012/07/12/scrapy_installation_introduce.html pyHook - ...

  4. python+selenium自动化测试环境安装

    因为自己安装自动化测试环境时,遇到过许多问题,自己整理了一下安装的步骤,感谢那些帮助过我的人. 1.安装python,我装的是3.5版本,网络上也有许多安装步骤,照着就可以了(其实一直下一步也行) 不 ...

  5. 爬虫之标签查找补充及selenium模块的安装及使用与案例

    今日内容概要 bs模块之标签查找 过滤器 selenium模块 今日内容详细 html_doc = """ <html> <head> <t ...

  6. Python 库/模块的安装、查看

    关于如何查看本地python类库详细信息的方法 关于如何查看本地python类库详细信息的方法 - 小白裸奔 - CSDN博客 python -m pydoc -p 1234 help('module ...

  7. python selenium 自动化测试环境安装

    注意:2.7和3.0版本的语法有些不一样 安装自动化测试软件 selenium(地址http://www.seleniumhq.org/download/) 安装步骤: 1.安装pythone运行环境 ...

  8. python selenium 的配置安装

    selenium的使用需要以下几个配置步骤. (1) 首先安装selenium,使用python自带的pip进行安装.若pip配置到系统环境变量,可以直接在cmd命令行中使用,若没有配置到到环境变量, ...

  9. python selenium模块 css定位

    selenium是python的非标准库,使用时需要下载安装 安装命令  pip install selenium selenium是python的自动化测试模块,可以模拟浏览器的行为 所以在使用之前 ...

随机推荐

  1. mgo03_linux7上安装mongo4.0

    下载地址https://www.mongodb.com/download-center#community tar -xvf mongodb-linux-x86_64-rhel70-4.0.0.tgz ...

  2. element-ui表单验证(电话,邮箱)

    element-ui Form表单验证 最近刚好使用了element-ui的form表单,官网只提供的示例,这里把一些常用的验证记录下来,方便后期查找最终的效果是这样的, 这个表单里还加入了一下其他组 ...

  3. 使用 Fetch完成AJAX请求

    使用 Fetch完成AJAX请求 写在前面 无论用JavaScript发送或获取信息,我们都会用到Ajax.Ajax不需要刷新页面就能发送和获取信息,能使网页实现异步更新. 几年前,初始化Ajax一般 ...

  4. Cache一致性协议之MESI

    http://blog.csdn.net/muxiqingyang/article/details/6615199 Cache一致性协议之MESI 处理器上有一套完整的协议,来保证Cache一致性.比 ...

  5. centos7.3 安装cuda8.0的 坑

    1. 安装依赖 yum -y install gcc-c++yum -y install epel-releaseyum -y install --enablerepo=epel dkmsyum -y ...

  6. PyCharm5 破解汉化

    作者博文地址:https://www.cnblogs.com/liu-shuai/ 破解: 将下列序列号复制到软件激活界面即可破解. 43B4A73YYJ-eyJsaWNlbnNlSWQiOiI0M0 ...

  7. pacman usage

    pacman使用 安装了系统时候, 应该立马使用pacman-mirrors -c China更新源, 再使用pacman -Syyn更新系统 编辑/etc/pacman.conf添加 [archli ...

  8. Web.Config详细说明

    (一).Web.Config是以XML文件规范存储,配置文件分为以下格式 1.配置节处理程序声明    特点:位于配置文件的顶部,包含在<configSections>标志中. 2.特定应 ...

  9. node Error: Could not locate the bindings file. Tried:解决

    问题描述: Error: Could not locate the bindings file. Tried: → C:\code\xxx\node_modules\deasync\build\dea ...

  10. MySQL锁行锁表

    select..for update; 给数据库表手动上锁 --锁行Begin; for update; --给 id=1 的行加上排它锁且 id 有索引 ; Commit; -- 锁表 BEGIN; ...