1、安装selenium

(下载地址: https://pypi.python.org/pypi/selenium)
如果是联网状态的话,可以直接在E:\Python27\Scripts下输入命令安装:
E:\Python27\Scripts>pip install –U selenium
如果没联网,先下载selenium并解压把整个目录放到E:\Python27\Lib\site-packages目录下。

2、火狐浏览器:

WebDriver 各版本: https://github.com/mozilla/geckodriver/releases 下载配套的geckodriver (geckodriver-v0.18.0-win64),下载放到E盘


测试脚本程序:(是否能正常使用)

#encoding = utf - 8
from selenium import webdriver
import time
#通过executable_path参数知名Friefox驱动文件所在路径,
#从selenium3.x版本开始,WebDriver/firefox/WebDriver.py程序文件中的_init_.py文件中,设置executable_path=“geckodriver”,使用Selenuim3.x编写的自动化测试脚本,使用Firefox浏览器测试时需要指明 # Friefox浏览器驱动程序“geckodriver.exe”文件所在路径。
driver = webdriver.Firefox(executable_path = "E:\\geckodriver")
#打开搜索首页
driver.get("http://www.sogou.com")
#在搜索输入框中输入“selenium”
driver.find_element_by_id("query").send_keys("selenuim")
#单击“搜索”按钮
driver.find_element_by_id("stb").click()
#等待3秒
time.sleep(3)
#退出浏览器
driver.close()

执行结果:打开火狐浏览器,进入搜狗搜索首页,搜索输入框输入selenium,点击搜索按钮,等待3秒,退出浏览器。

3、IE驱动程序

下载地址;”http://docs.seleniumhq.org/download

#conding=utf-8
from selenium import webdriver
import unittest
class VisitSogouByIE(unittest.TestCase):def setUp(self):#    self.driver = webdriver.Ie(executable_path = "E:\\IEDriverServer")self.driver = webdriver.Ie()def test_visitSogou(self):self.driver.get("http://www.sogou.com")print self.driver.current_urldef tearDown(self):self.driver.quit()
if __name__ == '__main__':unittest.main()

执行结果:
解决办法:
把下方4个安全设置的勾选都去掉

4、Chrome浏览器驱动

下载的驱动同谷歌浏览器要配对,防止谷歌浏览器升级造成驱动不可用,我们先取消google更新,教材如下:
https://jingyan.baidu.com/article/76a7e409f2137afc3b6e15be.html
驱动的下载地址如下:
http://chromedriver.storage.googleapis.com/index.html
http://npm.taobao.org/mirrors/chromedriver/
chromedriver与chrome的的对应版本

----------ChromeDriver v2.40 (2018-06-07)----------
Supports Chrome v66-68
Resolved issue 2446: Regression: Chromedriver 2.39 hangs on open when user-data-dir is specified and exists [[Pri-1]]
Resolved issue 779: Make ChromeDriver able to listen on requests from IPv6. [[Pri-1]]
Resolved issue 2339: Chromedriver couldn’t find the Android file using valid file path [[Pri-2]]
Resolved issue 2307: /session/:sessionId/send_command and /session/:sessionId/send_command_and_get_result should be changed to be proper extension commands [[Pri-]]

----------ChromeDriver v2.39 (2018-05-30)----------
Supports Chrome v66-68
Resolved issue 2436: ChromeDriver for Android does not provide useful error message for old adb version [[Pri-1]]
Resolved issue 2431: ChromeDriver tests that close Windows are flaky [[Pri-1]]
Resolved issue 2259: Click on component into an Iframe (with container padding > 0) is not working [[Pri-1]]
Resolved issue 2161: ChromeDriver remote debug port reservation race conditions [[Pri-2]]
Resolved issue 2420: Get Alert Text is not returning spec compliant error codes [[Pri-2]]
Resolved issue 2369: Clean up state of androidUseRunningApp feature [[Pri-2]]
Resolved issue 2406: Minimize/Maximize window need a w3c compliant endpoints [[Pri-]]

----------ChromeDriver v2.38 (2018-04-17)----------
Supports Chrome v65-67
Resolved issue 2354: The chromedriver crashes/lose connection when navigate to gmail [[Pri-0]]
Resolved issue 2381: Unknown session ID and cannot determine loading status [[Pri-1]]
Resolved issue 2198: ChromeDriver 2.34 doesn’t wait until iframe content loads after switching into iframe [[Pri-2]]
Resolved issue 2142: unknown error: Element is not clickable at point - after updating chrome browser and chrome driver to latest version [[Pri-2]]

----------ChromeDriver v2.37 (2018-03-16)----------
Supports Chrome v64-66
Resolved issue 2304: Test ChromeDriverSiteIsolation.testCanClickOOPIF fails on Chrome v66 for all desktop platforms [[Pri-1]]
Resolved issue 1940: Many window command endpoints are unimplemented in Chromedriver [[Pri-2]]
Resolved issue 1937: Get element rect is not implemented [[Pri-2]]
Resolved issue 2329: ChromeDriver does not allow value of 0 for extensionLoadTimeout option [[Pri-2]]

----------ChromeDriver v2.36 (2018-03-02)----------
Supports Chrome v63-65
Resolved issue 1819: testIFrameWithExtensionsSource is failing on Chrome v60+ [[Pri-1]]
Resolved issue 2221: Add command-line option to log INFO level to stderr [[Pri-2]]
Resolved issue 450: ChromeDriver hangs when switching to new window whose document is being overwritten [[Pri-2]]
Resolved issue 2235: Add option to control the wait for extension background pages [[Pri-2]]
Resolved issue 2234: fixed webview_devtools_remote_ is not right [[Pri-2]]
Resolved issue 2223: Unable to load extension if background page name starts with / [[Pri-2]]
Resolved issue 2280: ChromeDriver should be more extensible [[Pri-]]
Resolved issue 2231: Pixel 2 and Pixel 2 XL not working in Mobile Emulation [[Pri-]]
Resolved issue 746266: Chromedriver does not support OOPIF

----------ChromeDriver v2.35 (2018-01-10)----------
Supports Chrome v62-64
Resolved issue 2191: Executing JavaScript code fails if the script returns no result [[Pri-1]]
Resolved issue 2183: Connections Aren’t Persistent [[Pri-2]]
Resolved issue 2207: Some mobile emulation devices do not work [[Pri-2]]
Resolved issue 2177: Get local storage returns command names in Chrome 63 [[Pri-2]]
Resolved issue 2179: absolute time on log entries [[Pri-2]]

----------ChromeDriver v2.34 (2017-12-10)----------
Supports Chrome v61-63
Resolved issue 2025: Incorrect navigation on Chrome v63+ [[‘Pri-0’]]
Resolved issue 2034: Error looking for “Timeline.start” in Chrome [[‘Pri-2’]]
Resolved issue 1883: Unable to emulate android devices with Chromedriver 2.30 [[‘Pri-2’]]
Resolved issue 2103: Touch in mobile emulation doesn’t work [[]]

----------ChromeDriver v2.33 (2017-10-03)----------
Supports Chrome v60-62
Resolved issue 2032: ChromeDriver crashes while creating DNS resolver [[‘Pri-1’]]
Resolved issue 1918: Get/SetWindowSize & Get/SetWindowPosition commands are failing on Chromev62+ [[‘Pri-1’]]
Resolved issue 2013: Android 8.0.0 webviews not supported [[‘Pri-2’]]
Resolved issue 2017: In mobileEmulation “element is not clickable” if it is outside the visible area [[‘Pri-2’]]
Resolved issue 1981: chromedriver does not respect excludeSwitches flag [[‘Pri-2’]]
Partially Resolved issue 2002: Add Cookie is not spec compliant [[]]
Resolved issue 1985: FindElement raises the wrong error [[]]

----------ChromeDriver v2.32 (2017-08-30)----------
Supports Chrome v59-61
Resolved issue 1852: Error ‘Element is not clickable at point’ occurs on Chrome v61+ [[‘Pri-1’]]
Resolved issue 1950: DeleteCookie in Chrome v62 and Chromedriver v2.31 fails [[‘Pri-2’]]
Resolved issue 1942: ChromeDriver response in W3C mode is not standard compliant [[‘Pri-2’]]
Resolved issue 1910: Fails to retrieve default prompt text on Chrome v62+ [[‘Pri-2’]]
Resolved issue 1900: LaunchApp command throws UnknownError: cannot get automation extension on Mac and Windows Chrome v62+ [[‘Pri-2’]]
Resolved issue 1885: unknown error: Cannot use ‘in’ operator to search for ‘String’ in null [[‘Pri-2’]]
Resolved issue 1882: Chromedriver URI for Execute Async Script is not spec compliant [[‘Pri-3’]]
Resolved issue 1621: Implement session//window/fullscreen command [[‘Pri-3’]]
Resolved issue 1896: Characters ‘3’ and ‘#’ are not being entered using SendKeys on Mac Chrome v62+ [[]]
Resolved issue 1894: chromedriver 2.31 should be linked with glibc 2.17 [[]]
Resolved issue 1740: ChromeDriver session handshake needs to be W3C compliant [[]]
Resolved issue 1898: Wrong error is thrown while sending text to non prompt dialog. [[]]
Resolved issue 1888: Chromedriver doesn’t throw an exception when uploading an invalid file with selenium [[]]

----------ChromeDriver v2.31 (2017-07-21)----------
Supports Chrome v58-60
Resolved issue 1804: Flakiness when retrieving cookies using GetCookies command on Windows [[‘Pri-1’]]
Resolved issue 1879: Implement /session/{session id}/cookie/{name} command [[‘Pri-2’]]
Resolved issue 1860: WebDriverException: Message: unknown error: bad inspector message:"" when attempting to get page_source [[‘Pri-2’]]
Resolved issue 1293: Timed out receiving message from renderer on window.location change [[‘Pri-2’]]
Resolved issue 1849: ChromeDriver 2.30 AddCookie command uses incorrect default path [[‘Pri-2’]]
Resolved issue 1256: switchToFrame should throw StaleElementReferenceException in case the element is stale [[‘Pri-2’]]
Resolved issue 1786: Feature request: change chromeOptions to goog:chromeOptions [[‘Pri-3’]]
Resolved issue 1772: Chromedriver running against canary chrome w/ headless flag requires XVFB for sendKey interactions [[]]
Resolved issue 727979: Failed to set Chrome’s command line file on device for long command line [[‘Pri-3’]]

----------ChromeDriver v2.30 (2017-06-07)----------
Supports Chrome v58-60
Resolved issue 644: ChromeDriver does not delete the profile & scoped_dir* folders after test exits [[‘Pri-1’]]
Resolved issue 1114: unknown error:Maximum call stack size exceeded on calling any webdriver command [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1773: ChromeDriver crashes when using console.time on Chromev58+ [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1526: mobileEmulation not working for the listed devices in the chrome [[‘Pri-2’]]
Resolved issue 1777: NoSuchFrameException is thrown when attempting to focus on a frame with protocol “chrome-extension://” within a page with protocol “https://” on Chrome 58 [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1779: testWindowMaximize is failing on Mac for Chrome v60+ [[‘OS-Mac’, ‘Pri-2’]]
Resolved issue 1775: testShouldHandleNewWindowLoadingProperly failing on Chrome v60+ [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1796: Chromedriver failed to connect to Chrome on CrOS with latest canary build [[]]
Resolved issue 1353: Sending text to Alert / Confirm dialog should throw element not visible exception [[]]

----------ChromeDriver v2.29 (2017-04-04)----------
Supports Chrome v56-58
Resolved issue 1521: Assignment to Object.prototype.$family causes a crash [[‘Pri-1’]]
Resolved issue 1482: Chromedriver cannot handle the alert generated by onbeforeunload event [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1315: |switch_to.window| does not visually switch tabs [[‘OS-All’, ‘Pri-3’]]

----------ChromeDriver v2.28 (2017-03-09)----------
Supports Chrome v55-57
Resolved issue 1625: Error: cannot get automation extension on Chrome57+ [[‘OS-All’, ‘Pri-1’, ‘merge-merged-2987’]]
Resolved issue 1695: Chrome crashes on Linux32 bot [[‘OS-Linux’, ‘Pri-1’]]
Resolved issue 1467: A hang occurs when an alert dialog is displayed on Chrome 52+ [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1688: Exported Netlog with --log-net-log is truncated [[‘OS-Linux’, ‘OS-Mac’, ‘Pri-2’]]
Resolved issue 1388: find Elements is failing [[‘Pri-2’]]

----------ChromeDriver v2.27 (2016-12-23)----------
Supports Chrome v54-56
Resolved issue 1637: Getting window handles fails in the presence of shared workers on Chrome 55+ [[‘OS-All’, ‘Pri-1’]]

----------ChromeDriver v2.26 (2016-12-09)----------
Supports Chrome v53-55
Resolved issue 1607: Chrome 57+ with perf logs enabled fails with “unexpected command response” [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1502: sendKeys(): SPACE key does not work on Chrome 53 [[‘OS-All’, ‘Pri-1’]]
Resolved issue 984: Extend ChromeDriver capabilities to cover network throttling feature from Chrome DevTools [[‘OS-All’, ‘Pri-2’]]
Resolved issue 877: UnhandledAlertException not being propagated upwards [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1578: Flash plugin blocked after updating Chrome browser [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1617: Fullscreen command is not recognised [[‘OS-All’, ‘Pri-3’]]
Resolved issue 839: clear does not work on input type number with string value [[‘Pri-3’]]
Resolved issue 1500: “Could not handle JavaScript dialog” error occurs randomly when accepting confirmation dialogs. [[]]
Resolved issue 1541: find element with empty tag is raising wrong exception in findElement [[]]
Resolved issue 1540: empty tagname value should raise an error when doing findElements [[]]

----------ChromeDriver v2.25 (2016-10-25)----------
Supports Chrome v53-55
Resolved issue 1547: Chromedriver crashes during event Runtime.consoleAPICalled [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1514: GetLog command times out if an alert is showing [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1460: “Disable Developer Mode Extensions” exists on Mac, but not Windows [[]]

----------ChromeDriver v2.24 (2016-09-09)----------
Supports Chrome v52-54
Resolved issue 1497: GetLog fails when the current window is closed [[‘OS-All’, ‘Pri-0’]]
Resolved issue 1495: ChromeDriver crashes with “Check failed: !page_load_strategy_.empty()” [[‘OS-All’, ‘Pri-0’]]
Resolved issue 1463: SessionNotCreatedException: Runtime.evaluate missing ‘wasThrown’ on Chrome 54+ [[‘OS-All’, ‘Pri-0’]]
Resolved issue 1484: SendKeys of a Tab Key has no effect in Chrome 53 [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1431: GetLog command does not work for Chrome 54+ [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1411: sendKeys generates events that are missing some fields [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1451: Chrome 54+ session not created exception: Runtime.executionContextCreated has invalid ‘context’ [[‘Pri-1’]]
Resolved issue 984: Extend ChromeDriver capabilities to cover network throttling feature from Chrome DevTools [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1454: Net::ReadTimeout error on launching Canary v54 through RemoteWebDriver [[]]

----------ChromeDriver v2.23 (2016-08-04)----------
Supports Chrome v51-53
Resolved issue 1378: Android 6: Intitialization of Chrome driver fails when Chrome/Webview process is in running ® state [[‘OS-Android’, ‘Pri-1’]]
Resolved issue 1379: Chromedriver does not catch all available browser console log entries [[‘OS-All’, ‘Pri-2’]]

----------ChromeDriver v2.22 (2016-06-06)----------
Supports Chrome v49-52
Resolved issue 1348: Timeout error while navigating to URL on Chrome 51+ [[‘OS-All’, ‘Pri-0’]]
Resolved issue 1381: Timeout error occurs when alert dialog is displayed on Chrome 52+ [[‘OS-All’, ‘Pri-1’, ‘merge-merged-2743’]]
Resolved issue 1339: Failure when executing JS in a content script context [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1387: ChromeDriver hangs when calling driver.get() for same-process navigations [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1365: Touch emulation is not working under mobile emulation in Chrome 50+ [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1224: Chrome WebDriver throws an exception when trying to click a button inside a frame [[‘OS-All’, ‘Pri-2’]]
Resolved issue 107: ChromeDriver Won’t Switch To Frame inside nested frameset [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1368: ExecuteScript returns “Cannot read property ‘document’ of null” [[]]
Resolved issue 1355: Session not created exception when connecting to existing browser on localhost [[]]
Resolved issue 1331: “chromeOptions.excludeSwitches” is not working on Android [[]]

----------ChromeDriver v2.21 (2016-01-28)----------
Supports Chrome v46-50
Resolved issue 1276: empty FindElement response is returned while trying to find element with tagname object/embed [[‘OS-All’, ‘Pri-1’]]
Resolved issue 1272: GET url returns “data:text/html,chromewebdata” [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1310: ChromeDriver hangs (and times out) when inspecting inactive background pages [[‘OS-All’, ‘Pri-2’]]
Resolved issue 824: ChromeDriver creates two cookies when the cookie to add contains the domain [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1274: ExecuteScript sends script to wrong execution context [[‘OS-All’, ‘Pri-2’]]
Resolved issue 1249: Change “get current URL” behavior in ChromeDriver [[‘OS-All’, ‘Pri-2’]]
Resolved issue 904: include Alert text in UnhandledAlertError stack trace [[‘OS-All’, ‘Pri-2’]]
Resolved issue 474: getAttribute() fails when attribute name has colon (

4、selenium3的安装相关推荐

  1. 在Ubuntu 14.04.5 LTS上安装python模块selenium 3实录

    简介 Selenium是python模块库中一组web自动化测试工具集,提供多种语言的API,例如java,python,ruby,.net等,支持Firefox,Chrome,IE,Safari 等 ...

  2. window下搭建Python3.7+selenium3.1.1+pycharm环境

    1.安装Python3.7 1.1  下载 Python并安装 Python3.5 (勾选上 Add Python3.7 to PATH) 点击 Install Now,安装完成后将python路径加 ...

  3. Selenium3 + Python3自动化测试系列一——安装Python+selenium及selenium3 浏览器驱动

    一.安装Python https://www.python.org/downloads/ 验证Python是否安装成功.打开Windows命令提示符(cmd),输入python,回车 注意:在安装的过 ...

  4. robotframework安装_python3.9.0 + robotframework + selenium3 实例体验

    在win10上安装python3.9.0+robotframework中我们做了基本的使用robot framework的环境搭建,这一章主要通过一个简单的实例来体验下robot framework的 ...

  5. 简述python的安装过程_python3+ selenium3开发环境搭建-手把手教你安装python(详细)...

    环境搭建 基于python3和selenium3做自动化测试,俗话说:工欲善其事必先利其器:没有金刚钻就不揽那瓷器活,磨刀不误砍柴工,因此你必须会搭建基本的开发环境,掌握python基本的语法和一个I ...

  6. python不联网安装selenium_Anaconda python 离线安装selenium3.141很容易

    一直以来用Anaconda python(3.5以上版本)开发些爬虫及自动化测试的应用.由于一直用pip xxx install 联网安装一些第三方扩展包,以为开源时代必须这么装了. 因为内联网无法用 ...

  7. python3.6.1+selenium3.0环境安装问题及解决方法

    python3.6.1+selenium3.0环境安装问题及解决方法 参考文章: (1)python3.6.1+selenium3.0环境安装问题及解决方法 (2)https://www.cnblog ...

  8. python3+ selenium3开发环境搭建-手把手教你安装python(详细)

    环境搭建 基于python3和selenium3做自动化测试,俗话说:工欲善其事必先利其器:没有金刚钻就不揽那瓷器活,磨刀不误砍柴工,因此你必须会搭建基本的开发环境,掌握python基本的语法和一个I ...

  9. python离线安装selenium_UI自动化:Python+Selenium3安装

    注意: 1.Selenium3不在支持默认的浏览器,由浏览器官方提供的driver进行支持,提高稳定性 2.如果是java实现,只支持java8及以上(可忽略) 一.Windows环境 在Python ...

最新文章

  1. 大二上学数据结构和操作系统_毕业后的工作比上学要重要得多。 这是数据。...
  2. java hello world
  3. Android学习:自定义ViewGroup方法总结
  4. js如何写html中的内容,javascript怎样获取某个标签的内容?
  5. 夏日炎炎 数据中心要降温更要注意湿度影响
  6. 高效KMP字符匹配算法就这么简单
  7. Spring Boot学习笔记:Spring Boot核心配置
  8. Python中numpy读取高维数组中特定的行,列
  9. C++ 2022常见知识点
  10. 类库从自带的配置文件中获取信息(DLL文件 获取 DLL文件自带的配置信息) z...
  11. SQL Server 2008 R2 建立数据库,建立表,建立存储过程
  12. 浅谈WPF中的Calendar日历控件
  13. R中报错ERROR: configuration failed for package ‘magick’
  14. 微信公众号推广的四种有效办法
  15. 001 计算思维-卡内基梅隆大学计算机系主任周以真(英汉对照版)
  16. QLabel设置字体颜色
  17. 第一次改变root密码_密码学永远改变的一天
  18. 记录你生活的点滴,体会分享的快乐
  19. Google Chrome浏览器怎么由英文语言改成中文版
  20. 微信小程序开发初学者之入门步骤和体验

热门文章

  1. 美国ESS-HIFI音频解码芯片ES9023P
  2. uniapp 旅游_uni-app旅游类跨平台APP制作实战教程
  3. 转载的java面试题(值得推荐)
  4. 【Activity学习五】--基于SSM整合Activiti之请假流程实现(二)
  5. 表的列被set unused的机制
  6. 用手机模拟加密门禁卡【不用电脑】
  7. 平板安装Ubuntu18.04教程
  8. 【寒江雪】Go实现外观模式
  9. FineReport报表工具如何实现报表查询和分页显示
  10. 怎么用matlab画无差别曲线,MATLAB系列第二章初等模型.ppt