I am using the latest version of Selenium (2.37.0) with C# in Internet Explorer 10 (using the latest 32-bit InternetExplorerDriver, 2.37.0) to log in to a webpage, click on
Just wanted to give an update, in case anyone else has this same problem and finds this page. I haven't found a solution to my problem, but I came up with a workaround.
Originally, I was clicking on a link that opened a new window, and I was having trouble navigating Selenium to the new window. What I did instead was dig through the page's source code, find the button that I was clicking on, and figure out where that button points to. It would have been easiest if it was a simple hyperlink (www.whatever.com/....), but instead it was a Javascript function. That Javascript function builds up the hyperlink using some fixed characters and some variables; for example:
link(username, date) = "http://www.google.com/user=" + username + "?date=" + date;
So, going along with this example, I just figured out what variables were being fed in (username, date, etc.), built the URL myself, and navigated to it directly. Thus I didn't even have to open up and navigate to a new window at all.
This is due to incorrect security settings in Internet Explorer. You need to clear the check box for Enable Protected Mode for each of the four zones in the Internet Options dialog Security tab. The four zones must match.
Manual Method:
Now your InternetExplorerDriver should show the correct number of window handles and be able to switch between windows.
In my case manual changes only lasted until I rebooted and then the settings reverted, so I recommend modifying the registry each test run to be sure.
C# Example Using Registry:
const string zonesPath =
@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\";
const string internetZonePath = zonesPath + "3";
const string restrictedZonePath = zonesPath + "4";
const string name = "2500";
const int value = 3;
Registry.SetValue(internetZonePath, name, value, RegistryValueKind.DWord);
Registry.SetValue(restrictedZonePath, name, value, RegistryValueKind.DWord);
The zones are:
The path to each zone is: "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\{zone number above}.
The name of the key is always "2500".
The value to turn off protected mode is "3".
To turn on protected mode set the value to "0".
In order to get all of the handles, all the zones must be set to the same value.