I have just installed the latest version of Selenium 2.12.
I am trying to run the following java program using Selenium on IE. But unfortunately it's not working.
sample program
Here is the error message.
May 24, 2012 7:12:50 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO: Retrying request
Exception in thread "main" org.openqa.selenium.UnhandledAlertException: Modal dialog present (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 849 milliseconds
Build info: version: '2.21.0', revision: '16552', time: '2012-04-11 19:08:38'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_04'
Driver info: driver.version: InternetExplorerDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:175)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:134)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:459)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:140)
at org.openqa.selenium.ie.InternetExplorerDriver.setup(InternetExplorerDriver.java:113)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:66)
at ExampleProgram.main(ExampleProgram.java:13)
This is launching the IE 8 with the URL "http://localhost:15194/" and showing the content - This is the initial start page for the WebDriver server.
Please help me with what I'm doing wrong here. I have done the basic setup as mentioned in wiki
Just a small correction, the latest version is 2.21 and not 2.12.
Start your scripts with this
driver = Selenium::WebDriver.for :ie, :switches => %w[--ignore-certificate-errors --disable-popup-blocking --disable-translate]
Open your browser as an Admin, and change settings in Internet Options to allow popups and also keep "Protected Mode"disabled.
Apart from that, I guess the modal message could also be because there might be some insecure content that is being displayed on a https site.
So to avoid that the message from being displayed, also perform the following steps
IE-> Open as Admin
Go to Internet Options
Go to Security tab
Click on Custom Level button
Under Miscellaneous - Enable Mixed content
if this does not solve the issue, please share the exact message that is displayed on the modal popup.
Hope this helps
This worked for me after installing the new IE version - 9.
You have to download "IEDriverServer_Win32_2.29.0.zip". Extract it to a target folder and instantiate the Internet Explorer browser as below:
File file = new File("E:\\Global Blue\\globalblue-selenium-test\\gb-selenium-test\\lib\\IEDriverServer_Win32_2.29.0\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
WebDriver oWebDriver = new InternetExplorerDriver();
Try using:
Thread.sleep(3000);
It worked for me.
Related
System.setProperty("webdriver.chrome.driver","D:/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.navigate().to("https://link");
driver.findElement(By.cssSelector("#username")).sendKeys("id");
driver.findElement(By.cssSelector("#password")).sendKeys("pass");
driver.findElement(By.cssSelector("#clientName")).sendKeys("name");
driver.findElement(By.cssSelector("#submitButton")).click();
System.out.println("Okay !");
I set property for Chrome Driver. When I run it gives an error. (Below) I searched a lot but didn't found any solution.
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 10589
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'
System info: host: 'DESKTOP-9HVORCR', ip: '192.168.1.24', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:564)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at zaaa.main.main(main.java:11)
Caused by: java.lang.IllegalArgumentException: Unexpected char 0x131 at 23 in User-Agent value: selenium/3.12.0 (java wındows)
at okhttp3.Headers$Builder.checkNameAndValue(Headers.java:338)
at okhttp3.Headers$Builder.add(Headers.java:288)
at okhttp3.Request$Builder.addHeader(Request.java:177)
at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:85)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:101)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
... 6 more
I have tried these:
32/64 bit drivers.
Run it as administrator.
Creating a Try/Catch block.
Other drivers. (Like Operadriver.exe) (Result: Same error)
I think your windows is not english. I am having the same problem. When I tried the same in an english version windows 10 the code works without any problem.
Locale.setDefault(new Locale("en", "EN"));
you can also try this. it worked for me.
Add these lines before instantiating "WebDriver driver = new ChromeDriver();"
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--no-sandbox");
Then add the argument where you have declared Webdriver as shown below:-
WebDriver driver = new ChromeDriver(chromeOptions);
I hope it will help you.
Here you are using
selenium version : 3.12.0
chromedriver version : 2.40
When i tried to run with these configurations (they are latest at present)
I am able to launch the application without any exception and in the logs getting :
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 35584
Only local connections are allowed.
Jun 21, 2018 2:42:51 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Okay !
which is same as your starting logs.
My chrome browser version is :
Version 67.0.3396.87 (Official Build) (64-bit)
I think you should check your .m2 folder and delete
.m2\repository\org\seleniumhq\selenium
folder from there and then again try to download the dependencies.
Also update to latest chrome browser version.
Hope it helps.
This is a problem of Turkish Windows. As it is indicated in exception message the 'ı' character in user agent value "selenium/3.12.0 (java wındows)" is the cause of the exception.
The problem is the string "WINDOWS" is changed to lower case and it results "wındows" because of TR locale. I found that it is generated in class org.openqa.selenium.remote.http.HttpClientand added Locale.US like this.
String USER_AGENT = String.format(
"selenium/%s (java %s)",
new BuildInfo().getReleaseLabel(),
(Platform.getCurrent().family() == null ?
Platform.getCurrent().toString().toLowerCase(Locale.US) :
Platform.getCurrent().family().toString().toLowerCase(Locale.US)));
I compiled the library with my changes and it works now. I also opened a pull request on github.
You can also find my edited fork here.
Code trials:
driver.switchTo().frame(driver.findElement(By.xpath("//iframe[contains(#src,'path')]")));
driver.findElement(By.id());
Switching to Frame is may be successful but it didn't throw any NoSuchFrameException.
The same is working in Chrome and FireFox. But the same is not Working in IE (tried in IE9 and IE11).
WebDriver Used: IEDriverServer Ver: 3.12.0.0
Is it because of the Document mode? or due to any Page rendering issue?
In What Case will this happen?
HTML Source Code Link: Source Code
Tried to Find the id MF:txtentdon
I don't know if this is important or not, but It also throws HTTP Status: '404' -> incorrect JSON status mapping for 'stale element reference' (400 expected)
Error Stack Trace:
org.openqa.selenium.NoSuchElementException: Unable to find element with css selector == #MF\:txtentdon
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'N9776', ip: '172.29.18.139', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{proxy=Proxy(), acceptInsecureCerts=false, browserVersion=9, se:ieOptions={nativeEvents=true, browserAttachTimeout=0.0, ie.ensureCleanSession=false, elementScrollBehavior=0.0, enablePersistentHover=true, ie.browserCommandLineSwitches=, ie.forceCreateProcessApi=false, requireWindowFocus=false, initialBrowserUrl=http://localhost:6017/, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000.0, ignoreProtectedModeSettings=false}, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, browserName=internet explorer, pageLoadStrategy=normal, javascriptEnabled=true, platformName=windows, setWindowRect=true, platform=ANY}]
Session ID: 48da0488-5d2e-46db-996e-77f27f26ff28
*** Element info: {Using=id, value=MF:txtentdon}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:410)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:453)
at org.openqa.selenium.By$ById.findElement(By.java:218)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:402)
This error message...
org.openqa.selenium.NoSuchElementException: Unable to find element with css selector == #MF\:txtentdon
...implies that the InternetExplorerDriver server was unable to locate the desired element.
Your main issue seems to be the incompatibility between the version of the binaries you are using as follows:
You are using Selenium Java Client v3.4.0
You are using IEDriverServer v3.12.0.0
You are using JDK v1.8.0_131
So there is a clear mismatch between JDK v1.8.0-131, Selenium Client v3.4.0 and IEDriverServer v3.12.0.0.
Solution
While you work with Selenium Java Client, InternetExplorerDriver and Internet Explorer Browser ensure that:
You have fulfilled the Required Configuration as well as the additional considerations for Native Events and Browser Focus as per the documentation of InternetExplorerDriver.
You have upgraded JDK to recent levels JDK 8u171.
You have upgraded Selenium to current levels Version 3.12.0.
You have upgraded InternetExplorerDriver to current IEDriverServer v3.12.0 level.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
Take a System Reboot.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
A couple of additional facts you need to consider while switching frame to locate element:
Always induce WebDriverwait while switching to desired frame.
Once you switch to the desired frame induce WebDriverwait while you look out for the desired element.
As your desired element is having the attribute readOnly="readonly" so you need to use the ExpectedConditions as visibilityOfElementLocated() as follows:
So your effective code block will be:
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[contains(#src,'path')]")));
WebElement element = new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[#class='inputfld' and #id='MF:txtentdon']")));
You can try with this code :
driver.switchTo().frame(driver.findElement(By.xpath("//iframe[contains(#src,'path')]")));
System.err.println("inside frame");
WebElement element = new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.id("MF:txtentdon")));
Or
WebElement element = new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.name("MF:txtentdon")));
I recently found that my Selenium Java libraries were not working. Version 2.48.2 would open a Firefox window and then "stall" with no error within Netbeans nor Firefox itself before returning from new FirefoxDriver(). I figured that this version of Selenium might be broken so I found the latest Java libraries (Version 2.53.1) and have been trying to get them to work.
My issue now is almost the same but with two errors. The first is thrown by Netbeans when trying to execute new FirefoxDriver().
Exception in thread "AWT-EventQueue-0" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:32:46'
System info: host: 'MrComputer', ip: '192.168.0.101', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_65'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
...
The second is from Firefox itself. The window opens but instantly encounters the error.
Problem signature:
Problem Event Name: APPCRASH
Application Name: firefox.exe
Application Version: 47.0.0.5999
...
The code I am using is quite simple. Just the line
WebDriver driver = new FirefoxDriver();
I am by no means an extremely knowledgeable Selenium user so I am not sure what other information I could provide that might be of help.
EDIT: It seems that my Firefox version was not high enough to use the 2.53.1 Selenium libraries. My version of 47.0.0.5999 needed to be at least 47.0.1.
Prior to this, version 2.53.0 did need to make use of the MarionetteDriver as per this SO answer.
Unfortunately Selenium WebDriver 2.53.0 is not compatible with Firefox
47.0. The WebDriver component which handles Firefox browsers (FirefoxDriver) will be discontinued. As of version 3.0, Selenium
WebDriver will have MarionetteDriver as the default running
implementation for Firefox tests.
...
UPDATE
Selenium WebDriver 2.53.1 has been released on 30th June 2016.
FirefoxDriver is working again with Firefox 47.0.1 as browser.
For Selenium 2.53.1 the Firefox version needs to be at least 47.0.1. Updating my Firefox did the trick.
EDIT: It also seems that version 47.+ was not released to the Ubuntu archives for a few weeks after the Windows version.
I have an issue with Edge browser below is my code.The browser opens but control never goes to the browser instead execution halts and shows the error
service = new EdgeDriverService.Builder()
.usingDriverExecutable(new File("C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe"))
.usingAnyFreePort()
.build();
service.start();
driver = new EdgeDriver(service, DesiredCapabilities.edge());
driver.get("http://xyz.in");
On executing the line driver = new EdgeDriver(service, DesiredCapabilities.edge()); edge browser is getting launched after that execution is failing with the error as
'FAILED: test
org.openqa.selenium.remote.SessionNotFoundException: null (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.98 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52'
System info: host: 'ODERWin10', ip: '192.168.1.119', os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_13'
Driver info: org.openqa.selenium.edge.EdgeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:164)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:152)
at Pack1.CrossBrowserTest.test(CrossBrowserTest.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)'
Please suggest a solution, thanks in advance
Selenium 2.48.2 recognizes Windows 10 as Windows 8, i get the same error. The only way I've been able to get Edge to open and not hang is to manually open the MicrosoftWebDriver.exe file, and input whatever URL it tells me it's listening on:
DesiredCapabilities browser = DesiredCapabilities.edge();
browser.setBrowserName(DesiredCapabilities.edge().getBrowserName());
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:17556"), browser);
I had the same problem with SessionNotFoundException
Be sure to use the latest WebDriver for Windows Insiders from here https://www.microsoft.com/en-us/download/details.aspx?id=48740 (the normal one from here https://www.microsoft.com/en-us/download/confirmation.aspx?id=48212 does not work anymore on newer Windows 10 builds than 10240)
The 'Windows 8' display problem is as far as I know only a wrong output and not the root of the issue. Nonetheless it is fixed in selenium 2.49.0 (it's bug #669)
The problem is that you are trying to use Edge on a system in which it is not installed.
As told here :
System info: host: 'ODERWin10', ip: '192.168.1.119', os.name: 'Windows 8', os.arch: 'x86', os.version: '6.2', java.version: '1.7.0_13'
You are on Windows 8.
Edge is only supported and available on Windows 10.
You need to use a Windows 10 machine to run you test.
I am trying to automate a webpage using selenium in IE11. I have set the protected mode settings to same level and zoom level is 100%. While running the test it opens the website however gives the exception just after. Below is the code used.
File file = new File("C:\\Users\\Desktop\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath() );
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
true);
WebDriver driver = new InternetExplorerDriver(capabilities);
driver.get("http://www.google.com");
And the exception stacktrace
Started InternetExplorerDriver server (32-bit)
2.39.0.0
Listening on port 38122
Jul 11, 2014 1:50:02 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO: I/O exception (java.net.SocketException) caught when processing request: Software caused connection abort: recv failed
Jul 11, 2014 1:50:02 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO: Retrying request
Exception in thread "main" org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 18 milliseconds
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'Neeraj', ip: '10.136.180.161', os.name: 'Windows 7', s.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_60' Session ID: ab6edd65-8a66-41fa-be46-56fba7dbdfc9
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, ignoreZoomSetting=false, enablePersistentHover=true, ie.ensureCleanSession=false, browserName=internet explorer, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, version=11, ie.usePerProcessProxy=false, cssSelectorsEnabled=true, ignoreProtectedModeSettings=true, requireWindowFocus=false, handlesAlerts=true, initialBrowserUrl=http://localhost:38122/, ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:348)
at org.openqa.selenium.By$ById.findElement(By.java:220)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)
at Test1.main(Test1.java:27)
Any suggestions on how to resolve this.
First of all, don't use
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
as you have already set Protected mode settings. For the issue you are seeing, it should be because of the missing registry settings that is added as a prerequisite for running tests in IE11:
https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration
I am using IE 11 - 64 bit windows machine. This point worked for me.
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.
The solution suggested by #David Kemp is not working for the ie 11 of windows 10 - 64 bit . I have added the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet explorer\Main\FeatureControl\FEATURE_BFCACHE according to the steps mentioned For IE 11 only following https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration but after opening the https certificate page (url https://my-page:9443) it is unable to execute driver.navigate().to("javascript:document.getElementById('overridelink').click()"); throwing NoSuchWindowException
However same works fine for ie 11 of windows 7-64 bit and able to execute the scripts .
The work around to make ie 11 work for win 10 is by setting initialBrowserUrl capabilities to https://my-page:9443 like below
capabilities.setCapability("initialBrowserUrl", "https://my-page:9443");
but I am still confused why for ie11 / windows 10 it's different ?
Below solution also works if from current page you navigate on next page on some action/event and selenium driver doesnt recognise window :-
For 64-bit Windows installations, the key is:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet explorer\Main\FeatureControl\FEATURE_BFCACHE
Inside this create a DWORD value named iexplore.exe with the value of 0.
I found that, if the launched browser is kept on focus, you will get that exception. As soon as you launch the webdriver, open any other window, for example, you can open eclipse as soon as the script launches IE Driver. Script execution starts, and then you can open you IE Driver.. to handle it through scripts, you add the below code:
public WebDriver driver, driver1;
System.setProperty("webdriver.ie.driver", System.getProperty(
"webdriver.ie.driver", "./BrowserDrivers/IEDriverServer.exe"));
driver = new InternetExplorerDriver(cap);
this.driver.manage().deleteAllCookies();
this.driver.manage().timeouts().implicitlyWait(WaitTimeConstants.WAIT_TIME_LONG, TimeUnit.SECONDS);
this.driver.get("yourApplication.com");
this.driver.manage().window().maximize();
public WebDriver driver, driver1;
System.setProperty("webdriver.ie.driver", System.getProperty(
"webdriver.ie.driver", "./BrowserDrivers/IEDriverServer.exe"));
driver1 = new InternetExplorerDriver(cap);
this.driver1.manage().deleteAllCookies();
this.driver1.get("http://www.google.com");
this.driver1.manage().window().maximize();
Added domain of AUT to list of "Trusted Sites" for i.e. in "Internet Options". Solved the problem.
IE Options --> Security Tab -> Uncheck "Enable Protected Mode" worked for me.
Add http://localhost/ to your trusted sites in IE11. This worked for me,after trying everything else without results.
Ignore above all... i have tried below line in my desired capabilities for IE driver then its worked .. :)
ieCapabilities.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL,false);
You can follow a few options from below:
Use relative paths in the project, later you can choose to get its absolute path.
Setting the Protected mode setting for all, to either enabled or disabled.
Try understanding what really this exception mean "org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 18 milliseconds"
This states that whatever being done by your code (the web driver) is not able to identify the window of IE.
The possible causes can be:
a. Multiple driver instances are already running which were instantiated by older runs and could not have been terminated by quite().
b. The sometimes when you use close() on a driver it will not terminate the IE Driver, so use quite() after closing inside a finally block.
Yes, add some Exception handling to avoid the above issue.
Exception "org.openqa.selenium.NoSuchWindowException" also suggests that web driver instance is not able to get the handle of IE's window tab. I faced this issue when accidentally, the browser was closed and the code was still trying to locate and do some action on a web element. In this case, the driver throws this exception to tell that there is no IE browser opened at all.
Having a check on the opening of browser can also help, I usually keep some piece of code that gives logs of used Driver object and the port where it is trying to connect and to which browser to.
For me, point 4 & 5 worked. but you might wanna just change the web driver's service i.e. browser. IE is just too slow sometimes to honour the selenium API calls :(