RemoteWebDriver works once, then throws NoSuchWindowException - selenium

I've come upon a strange issue while setting up a Selenium Grid. My RemoteWebDriver works once, and then throws a NoSuchWindowException if I try to do anything else with it.
For example, if I run the following test (which I wrote just to explore this problem):
#Test
public void testStuff() {
try{Thread.sleep(2000);}catch(Exception e){}
driver.get("http://www.google.com");
try{Thread.sleep(2000);}catch(Exception e){}
driver.get("http://www.stackoverflow.com");
System.out.println(driver.getTitle());
}
An IE browser pops up on the virtual machine that I'm sending it to. That browser then successfully goes to google. However, when I try to do anything else with it (like go to another website, or get the window's title), I get the following exception:
org.openqa.selenium.NoSuchWindowException: Unable to get browser(WARNING: The server did not provide any stacktrace information)
I have tried all sorts of combinations, with the same result every time: I can successfully call a method off of the RemoteWebDriver once, but the second time it throws this exception.
Does anyone have any ideas what might be causing it?
Things I've checked:
The IEDriverServer and the VM are both 64-bit.
The console for both the Hub and the Node yield no useful clues. The Node console contains:
INFO - Executing: [get: http://www.google.com] at URL: /session/de0a7b62-33a1-4330-b9a9-25b99f5504-cf/url)
INFO - Done: /session/de0a7b62-33a1-4330-b9a9-25b99f5504-cf/url
INFO - Executing: [get: http://www.stackoverflow.com] at URL: /session/de0a7b62-33a1-4330-b9a9-25b99f5504-cf/url)
INFO - Done: /session/de0a7b62-33a1-4330-b9a9-25b99f5504-cf/url
WARN - Exception thrown
org.openqa.selenium.NoSuchWindowException: Unable to get browser (WARNING: The server did not provide any stacktrace information)
In response to Richard's comment, the WebDriver really is quitting at then end of the test. I'm printing out the following in the console:
successfully strt RemoteWebDriver: internet explorer on WINDOWS (40b01604-9217-4f67-b809-61cd90d23c84)
preparing to quit RemoteWebDriver: internet explorer on WINDOWS (40b01604-9217-4f67-b809-61cd90d23c84)
successfully quit RemoteWebDriver: internet explorer on WINDOWS (null)
Also, in the Task Manager on the VM, the "IEDriverServer" process goes away at the end of the test. But the weird thing is, The browser itself does not close. I have no idea what could be causing that, and whether or not it is related.

That sounds to me as beeing a typical problem with the IEDriverServer.exe, occurring if configuration on a node machine isn't done properly.
Be shure to follow all requirements described on Selenium Website. Corresponding part cited here:
Required Configuration
The IEDriverServer exectuable must be downloaded and placed in your PATH.
On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.
I had the same issue and was able to solve it with these hints.

Related

How to run test in IE browser using OxygenHQ?

I want to run a simple test using OxygenHQ, of opening wikipedia and then search for hello world. The script written is working fine for Chrome and Firefox but in case of IE mutiple windows are opening without the page and then it fails eventually.
Is there any way to fix this? I went through the docs provided at http://docs.oxygenhq.org/guide-web-intro.html but could not get a concrete answer on why this is only happening for IE. Here is a console output and screenshot for reference.
Console Output :
Initializing...
Starting iteration #1
UNKNOWN_ERROR - undefined: args[0].endsWith is not a function at line 1Test finished with status --> FAILED
Details:
Browser: Internet Explorer
Version: 11.535.18362.0
OS: Windows 10
This might be connected to your internet settings
make sure that the IE screen size is 100%
make sure all Internet options in Security Tab (Internet, Local Internet etc') are either with the Enable protected mode on or off (should be the same for all)
see picture
Have a look again at the Oxygen web site, it has had a major facelift and a lot of new content

How to connect to firefox instance with debugger port?

I am trying to do remote debugging on a Firefox instance similarly to how I would do it in Chrome:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
If I start Chrome with this parameter, I can then inspect pages from another Chrome instance by navigating to localhost:9222
I am trying to do the same with Firefox:
Set "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging" options to true
opened firefox with the following parameter:
"C:\Program Files\Mozilla Firefox\firefox.exe" -start-debugger-server 1234
Despite this, when I navigate to localhost:1234, the following happens:
I get multiple popups, that tell me there is an incoming request to Firefox
Even when I click okay, nothing seems to happen
localhost:1234 gives "refused to connect" error
Firefox has more debug functionality than chrome/chromium and to access those you need to:
Goto about:debugging
( Can be found in GUI under: triple-bar Button[≡] > Web Developer > Remote Debugging )
Enter your host Network Location and click Add
Click on your debugging instance on the right side.
Debug whatever you wanna debug(Tabs, Extensions or Processes etc.)

Internet Explorer 11 getting stuck randomly while executing tests through IEDriverServer and Selenium

I'm having issues that IE version 11 stuck randomly on some page. the code is working fine because whenever i restart the program sometimes it work but the most annoying will be randomly stuck after click and load the page. is this normal on IE? i never had this type of issues when using Chrome. but this website works only at IE. can i know the cause of this problem is it the driver?, the website itself? or Network security?
While you work with Internet Explorer v11 you need to configure your test framework with the Required Configuration. Apart from these specifically only for IE 11 you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates as follows:
For 32-bit Windows installations, the key you must examine in the registry editor is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE.
For 64-bit Windows installations, the key is:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE.
Trivia
How does the registry entry HKEY_LOCAL_MACHINE\…\FEATURE_BFCACHE for InternetExplorerDriver solves the Internet Explorer 11 issue?
Internet Explorer Protective mode setting and Zoom levels
Selenium InternetExplorerDriver doesn't get focus on the window
How to ignore protected Mode Settings for Internet Explorer using setCapability() through Selenium and Java?

Unable to perform activities on edge after opening the browser

System.setProperty("webdriver.edge.driver","F:\\VW_MU_Util\\MicrosoftWebDriver.exe");
WebDriver driver = new EdgeDriver();
This is opening the edge browser however I cant go ahead since i'm getting error as:
org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)
I tried to change the IE security settings but its opening the IE browser which i dont want to.
Make sure you have initiate correct Edge Driver, as according to your OS version.
Ref link : https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Steps :
Trace Build version:
Download correct version of Driver:
Once it finished, Verify it with demo project without any project capabilities. If it run successfully on sample project, It might cause browser capability with Selenium Browser.

Selenium RemoteWebDriver IE11. Cannot upload file correctly

I have a problem in selenium uploading files in IE11. In my c# code I make
driver.FindElement(By.Id("file")).SendKeys(filepath);
and in 95% of executions it works OK in IE11 but at others I see only opened upload window and test hangs after it.
I'm sure that path to image is correct, I see it in console of selenium server.
Does anybody have some ideas of reason of such behavior?
UPDATE 08/10/2015:
I updated selenium server from 2.45 version to 2.47.1 and it seems that issue appears not so often as before but it is still there
I verified confuration on IE
The IEDriverServer exectuable must be downloaded and placed in your PATH.
On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.
My configuration is correct