Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoSuchWindowException was unhandled : Unable to find element on closed window. IE 11 - Selenium C#

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.

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.

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."

Below are my steps:-

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.

like image 948
ASHWANI KUMAR Avatar asked Dec 15 '22 18:12

ASHWANI KUMAR


1 Answers

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

like image 173
Günter Zöchbauer Avatar answered Dec 18 '22 12:12

Günter Zöchbauer