您好,登錄后才能下訂單哦!
selenium_webdriver 驅動不了瀏覽器問題
最近很多同學,自己在學習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/
好了,時間不早了,就寫到這里吧,有問題再更新。。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。