NoSuchWindowException未处理:无法在关闭的窗口中找到元素.IE 11 - Selenium C#

ASH*_*MAR 4 c# selenium visual-studio-2010 internet-explorer-11

可能这个问题之前已被多次询问过.但我在stackoverflow中经历了所有相关问题,但找不到任何令人满意的解决方案.

我正在使用C#在VS2010中编写一个selenium自动化代码,IE11是我的网络浏览器,我正在进行测试.在Windows 7中使用IEDriverServer 32位版本打开IE实例.

我已经知道selenium和IE 11之间存在一些兼容性问题,但是到目前为止我的代码工作正常,当我开始收到此错误时 - "NoSuchWindowException未处理:无法在关闭的窗口中找到元素."

以下是我的步骤: -

IWebDriver driver = new InternetExplorerDriver("D:\\");
driver.Navigate().GoToUrl("http://aiaw00572.belldev.dev.bce.ca:8060/UTM_MechHDTool_UserWebApp");

driver.FindElement(By.Id("ctl00_cpMainContent_radcboTaskType_Input"), 10).Click();

driver.FindElement(By.XPath("//div[@id='ctl00_cpMainContent_radcboTaskType_DropDown']/div/ul/li[2]")).Click(); (this step select a drop down option which performs a postback on the page)

driver.FindElement(By.Id("ctl00_cpMainContent_utmTaskGrid_ctl00_ctl06_imgbtnStartWorking")).Click();//Getting error on this step. Earlier i was not getting it anywhere
Run Code Online (Sandbox Code Playgroud)

我搜索了这个问题的解决方案,并了解了一个解决方案,其中必须进行一些注册表更改才能解决它,尽管这也无法确认它是否能解决问题.但是这里的问题我甚至无法检查这个解决方案,因为我的系统中没有任何管理员权限.

所以只是想知道其他人是否也遇到了问题,并提出了一些解决方案,所以他/她可以在这里分享,因为我在这里急需一个解决方案.

Gün*_*uer 7

在以管理员身份运行IEDriverServer或为所有区域设置保护模式后为我工作(/sf/answers/1496125711/)


nhu*_*uvy 5

错误:

org.openqa.selenium.NoSuchWindowException:无法在关闭的窗口中找到元素(警告:服务器未提供任何堆栈跟踪信息)

步骤1.更改Windows注册表.如果您使用Internet Explorer 11 x64(64位),则创建文件ie11_win64.reg具有以下内容:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BFCACHE]
"iexplore.exe"=dword:00000000
Run Code Online (Sandbox Code Playgroud)

然后运行它.

如果您使用Internet Explorer 11 x86(32位),则创建文件ie11_win32.reg具有以下内容:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BFCACHE]
"iexplore.exe"=dword:00000000
Run Code Online (Sandbox Code Playgroud)

然后运行它.

第2步.在Internet Explorer中设置.取消选中全部(或全部检查,区域必须相同:Internet,本地Intranet,受信任的站点,受限制的站点)

在此输入图像描述

在此输入图像描述

在此输入图像描述

在此输入图像描述