selenium_webdriver驱动不了浏览器问题
selenium_webdriver 驱动不了浏览器问题
创新互联公司主要从事成都网站建设、成都网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务上城,十余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220
最近很多同学,自己在学习selenium工具时,碰到一个最多的问题就是为什么我创建了一个浏览器实例,driver.get(url)时,却打不开浏览器,或者就算打开了无法输入相应的URL,这是为什么呢?
笔者最近在自学selenium工具时,也碰到了这些问题,最后发现是驱动版本的问题,因为webdriver 在启用我们指定的浏览器 Chrome/Firefox/I e时,需要调用相应的驱动,不同的浏览器版本对应的驱动不一样,有些驱动只支持哪几个浏览器相关版本,例如以Chrome为例:
----------ChromeDriver v2.7 (2013-11-22)---------- Supports Chrome v30-33 Resolved issue 615: ChromeDriver doesn't work well with auto detect proxy settings [OS-Windows, Pri-0] Resolved issue 614: Implement new redirectionless /session command [Pri-0] Resolved issue 625: logging broken on windows [Pri-0] Resolved issue 573: chromedriver crashes on windows occasionally [OS-Windows, Pri-1] ----------ChromeDriver v2.6 (2013-11-04)---------- Supports Chrome v29-32 Resolved issue 599: Chromedriver failes after MacOS X Mavericks upgrade [OS-Mac, Pri-0, Type-Defect] Resolved issue 585: Return user data dir via capabilities [] ----------ChromeDriver v2.5 (2013-11-01)---------- Supports Chrome v29-32 Resolved issue 600: Support minidump for chrome crashes on Linux with a new capability minidump_path. [Pri-0] Resolved issue 569: A change in blink breaks scrolling an element into view [Pri-0] Resolved issue 554: Release notes broken [Pri-0] Resolved issue 545: hang when debugger is invoked via JS [Pri-0] ----------ChromeDriver v2.4 (2013-09-30)---------- Supports Chrome v29-32 Resolved issue 444: chromedriver sometimes hangs when launching chrome (chrome fails to bind to debug port) [Pri-0] Resolved issue 529: WebDriver clients fail when attempting to use empty chromeOption binary string [Pri-0] Resolved issue 536: remote debugging port taken during startup [Pri-0] Resolved issue 520: Some commands hangs if the target window already crashes. [] Resolved issue 519: Support JS heap snapshot [] ----------ChromeDriver v2.3 (2013-09-02)---------- Resolved issue 309: Screenshot is blank from an VM instance without an open RDC connection [Pri-1] Resolved issue 445: chromedriver crashes when port is in use [Pri-1] Resolved issue 461: TouchUp, TouchDown, and TouchMove commands [OS-All, Pri-1] Resolved issue 489: No longer using packed extension id when loading custom extensions [Pri-3] Resolved issue 491: Extension does not have its _id_ [Pri-3] Resolved issue 497: unrecognized chrome option: useExistingBrowser [Pri-3] ----------ChromeDriver v2.2 (2013-08-06)----------
以上我们可以看到,不同的ChromeDriver 支持的浏览器版本是不一样的,如果我们拿ChromeDriver v2.4 的驱动,去驱动Chrome 35或者以上的版本,可能会出现前面提到的各种问题,其他类型浏览器类似,碰到这类问题一般都是驱动引起的。
ChromeDriver 驱动下载及支持的浏览器版本号,以下链接可以找到:
http://chromedriver.storage.googleapis.com/index.html?path=2.7/
好了,时间不早了,就写到这里吧,有问题再更新。。
网页题目:selenium_webdriver驱动不了浏览器问题
分享地址:http://scjbc.cn/article/gihids.html