2016-05-12 25 views
1

我有一些使用Java-Selenium可以在Chrome/Firefox/IE9上正常工作的自動化測試。我有Selenium 2.47並使用適當的驅動程序。最近我已升級到IE 11,從那時起我的測試失敗,除了以下例外:我的硒代碼不適用於IE 11

*org.openqa.selenium.NoSuchWindowException: Unable to find elements on closed window (WARNING: The server did not provide any stacktrace information)* 
Command duration or timeout: 31 milliseconds 
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16' 
System info: os.name: 'Windows 7', os.arch: 'amd64', java.version: '1.8.0_45' 
Driver info: org.openqa.selenium.ie.InternetExplorerDriver 
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:13059/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}] 
*** Element info: {Using=name, value=username} 

有人可以指導我呢?

它在登錄頁面本身失敗。

+0

需要更多信息bro。 –

+0

這是引發此異常的行:webElements = wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(byType)); – amit

回答

2

IE11和硒存在問題。您需要在Windows註冊表中配置IE11才能解決問題。

要解決的問題,創建一個名爲「IEXPLORE.EXE」,並在以下關鍵的 值0(32位Windows)的DWORD值:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE 

爲64位Windows安裝,下面的鍵用於:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE 

這將解決「無法獲取瀏覽器」的錯誤,並與IE11應 解決不支持的問題。

+0

感謝Kanwar。它爲我工作。 – amit

+0

如果你只是在沒有歸屬的情況下竊取他人的作品,你至少可以改變第一人稱的評論。您,回答者,不會更新項目wiki,因爲我是上述文本的實際作者,[兩年多前](https://github.com/seleniumhq/selenium-google-code-問題存檔/問題/ 6511)。 – JimEvans

相關問題