問題描述
我有一個圍繞 Selenium-WebDriver 開發(fā)的自動化框架,它啟動 Chrome 并導航到指定的 URL 并執(zhí)行指定的自動化.當我委托框架執(zhí)行一項長期任務(wù)并讓它通宵運行時(運行不成功).第二天,當我嘗試重新運行一組新測試時,Selenium 能夠啟動 Chrome,但瀏覽器無法導航到指定的 URL.以下是詳細的堆棧跟蹤.
I have an automation framework developed around Selenium-WebDriver which launches Chrome and navigates to specified URL and performs specified automation. When I commissioned the framework to perform a long task and left it overnight to run (Run was not successful). The following day when I tried to re-run a new set of Tests, Selenium was able to fire Chrome but the Browser would not navigate to the specified URL. The following is the detailed stack trace.
Starting ChromeDriver (v2.7.236900) on port 60678
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=41.0.2272.118)
(Driver info: chromedriver=2.7.236900,platform=Windows NT 6.3 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.12 seconds
Build info: version: '2.24.1', revision: '17205', time: '2012-06-19 16:53:24'
System info: os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_25'
Driver info: driver.version: RemoteWebDriver
Session ID: a2fafed66d51994e3ef57bada99fddbf
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:472)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:683)
at com.gravitant.utils.Util.launchBrowser(Util.java:1711)
at com.gravitant.test.RunTests.start(RunTests.java:147)
at com.gravitant.test.RunTests.main(RunTests.java:80)
這是我第二次面臨同樣的問題.當我嘗試用谷歌搜索錯誤時,我能夠找到 this 特定論壇.我試圖重新下載 Chrome_driver 但沒有幫助.重新啟動系統(tǒng)也沒有幫助.我仔細檢查了代碼和所有設(shè)置,但沒有任何改變.奇怪的是,我偶然發(fā)現(xiàn)了一個奇怪的解決方案.
This is the second time I am facing the same issue. When I tried to google search the error I was able find this particular forum. I tried to re-download Chrome_driver but it did not help. Restarting the system did not help either. I double checked the code and all the set-up but nothing was changed. Curiously I was able to stumble upon a curious solution.
解決方案 - 重新安裝 Chrome 瀏覽器解決了該問題.我能夠完美地運行測試.
Solution - Re-installing Chrome Browser solved the issue. I was able to run the tests perfectly.
我很想知道為什么會這樣,以及是什么導致 chrome 表現(xiàn)得如此奇怪.
I am curious to understand why this was and what might have caused chrome to behave so oddly.
推薦答案
這里的問題是,Selenium-WebDriver 無法在 chrome 中啟動已安裝的 3rd Party Extensions.我今天也遇到了這個問題,所以我沒有重新安裝谷歌瀏覽器,而是刪除了我在 Chrome 上安裝的所有擴展程序.我安裝了幾個添加攔截器"擴展.
The issue here is, Selenium-WebDriver is unable to launch the installed 3rd Party Extensions in chrome. I encountered the issue today as well, so instead of re-installing google chrome, I deleted all the extensions I had installed on Chrome. I have a couple of "Add Blocker" extensions installed.
這篇關(guān)于從 Selenium 觸發(fā)時,Google Chrome 無法導航到指定的 URL的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!