NoSuchWindowException未处理:无法在关闭的窗口上找到元素. IE 11-硒C# [英] NoSuchWindowException was unhandled : Unable to find element on closed window. IE 11 - Selenium C#

查看:504
本文介绍了NoSuchWindowException未处理:无法在关闭的窗口上找到元素. IE 11-硒C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

May be this question has been asked many times before. But i went through all the related questions in stackoverflow , but couldn't find any satisfactory solution.

好吧,我正在使用C#在VS2010中编写硒自动化代码,IE11是我正在对其进行测试的Web浏览器.在Windows 7中使用IEDriverServer 32位版本打开IE实例.

Well i'am writing a selenium automation code in VS2010 using C#, IE11 is my web browser on which i'am performing testing. Using IEDriverServer 32bit version in Windows 7 to open IE instance.

我已经知道selenium与IE 11之间存在某种兼容性问题,但是直到现在我开始收到此错误时,我的代码仍然可以正常工作-未处理NoSuchWindowException:无法在关闭的窗口上找到元素."

I already knew that there is some compatibility kind of issue between selenium and IE 11, but still my code worked fine up till now when i started getting this Error - " NoSuchWindowException was unhandled : Unable to find element on closed window."

以下是我的步骤:-

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

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

I searched for the solutions for this problem and came to know about one solution in which some registry change has to be done to solve it, though that also does not confirm that it will solve the problem. But the problem here i can't even check this solution as i don't have any administrator privilege in my system.

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

So just wanted to know if someone else has also faced the problem and came with some solution, so he/she can share it here please as i badly need a solution in here for this situation.

推荐答案

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

Worked for me after running IEDriverServer as admin or setting protected mode for all zones (https://stackoverflow.com/a/21373224/217408)

这篇关于NoSuchWindowException未处理:无法在关闭的窗口上找到元素. IE 11-硒C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆