selen在导航到IE11上的其他页面时无法在关闭的窗口中找到元素

时间:2016-08-24 09:34:08

标签: selenium

System.setProperty("webdriver.ie.driver", System.getProperty("user.dir") + "/Driver/IEDriverServer.exe");
Map<String, By> objectMap = DataHelper.getObjectMap();
WebDriver driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("XXXXX");
driver.findElement(objectMap.get("processworld_username")).clear();
driver.findElement(objectMap.get("processworld_username")).sendKeys("XXX");
driver.findElement(objectMap.get("processworld_password")).clear();
driver.findElement(objectMap.get("processworld_password")).sendKeys("XXX");
driver.findElement(objectMap.get("processworld_sign_in_btn")).click();
driver.findElement(objectMap.get("patt_createproject_link")).click();
  

org.openqa.selenium.NoSuchWindowException:无法找到元素   关闭窗口(警告:服务器未提供任何堆栈跟踪   信息)命令持续时间或超时:10毫秒构建信息:   版本:'2.48.2',修订版:'41bccdd',时间:'2015-10-09 19:55:52'   系统信息:主机:'PHMNL1-SQLXiAn',ip:'10 .164.228.143',os.name:   'Windows Server 2008 R2',os.arch:'amd64',os.version:'6.1',   java.version:'1.8.0_101'驱动程序信息:   org.openqa.selenium.ie.InternetExplorerDriver功能   [{browserAttachTimeout = 0,ie.enableFullPageScreenshot = true,   enablePersistentHover = true,ie.forceCreateProcessApi = false,   ie.forceShellWindowsApi = false,pageLoadStrategy = normal,   ignoreZoomSetting = false,ie.fileUploadDialogTimeout = 3000,version = 11,   platform = WINDOWS,nativeEvents = true,ie.ensureCleanSession = false,   elementScrollBehavior = 0,ie.browserCommandLineSwitches =,   requireWindowFocus = false,browserName = internet explorer,   initialBrowserUrl = http://patttest.emersonprocess.com/main.asp?url=,   javascriptEnabled = true,ignoreProtectedModeSettings = false,   enableElementCacheCleanup = true,unexpectedAlertBehaviour = dismiss}]   会话ID:9a00ac20-b304-4ba5-9667-149392ceedc5   ***元素信息:{using = partial link text,value = Create Project} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)   at sun.reflect.NativeConstructorAccessorImpl.newInstance(未知   来源)at   sun.reflect.DelegatingConstructorAccessorImpl.newInstance(未知   来自java.lang.reflect.Constructor.newInstance(未知来源)   在   org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)   在   org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)   在   org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)

点击processworld_sign_in_btn后,页面将导航到新页面,然后出现错误,我尝试为所有区域设置保护模式,但它对我不起作用

1 个答案:

答案 0 :(得分:1)

我也遇到过同样的问题。它通过简单的注册表更新解决了。我希望这个解决方案可以帮助你 -

您需要在注册表编辑器中检查密钥 - HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_BFCACHE

在64位系统中,您可以在 HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_BFCACHE

中找到相同的密钥

子键 FEATURE_BFCACHE 可能存在也可能不存在。如果不存在,则必须创建它。在此密钥内,创建 DWORD 值并将其命名为 iexplore.exe ,其值为 0