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 :(
Related
I'm trying to execute my selenium automation in a chrome which is already open.
I follow these steps: https://medium.com/#harith.sankalpa/connect-selenium-driver-to-an-existing-chrome-browser-instance-41435b67affd
I open a chrome with this line:
/opt/google/chrome/chrome --remote-debugging-port=6666
This is my java code
System.setProperty("webdriver.chrome.driver", "/../chromedriver");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("debuggerAddress","localhost:6666");
// Initialize browser
WebDriver driver = new ChromeDriver(options);
// Open Google
driver.get("http://www.google.com");
WebElement searchBox = driver.findElement(By.name("q"));
searchBox.sendKeys("jrichardsz");
// Close browser
driver.close();
When I run this code I get this log:
Starting ChromeDriver 84.0.4147.30 (48b3e868c0aa7e814951969b4c0b6f6949e110a8-refs/branch-heads/4147#{#310}) on port 12155
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
And after some seconds I get: chrome not reachable error
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot connect to chrome at localhost:6666
from chrome not reachable
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'jane_doe', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '***', java.version: '1.8.0_151'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x556168a87ea9 <unknown>
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
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:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
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:157)
at OpenedChrome.main(OpenedChrome.java:24)
I tried also with chromiun and opera and I get the same error.
My chrome is opened but java cannot connect to it.
I reviewed these links unlucky
Headless chrome: chrome not reachable
WebDriverException: chrome not reachable
Chrome not reachable
You can set below property to check the debug logs
System.setProperty("webdriver.chrome.verboseLogging", "true");
Example for Windows OS:
If any existing chrome process is running and you have open new instance of chrome using
> chrome.exe --remote-debugging-port=9222
then you may get below logs while executing the selenium script in question
[DEBUG]: DevTools HTTP Request: http://localhost:9222/json/version
[DEBUG]: DevTools HTTP Request failed
To open the clean instance of chrome browser for debugging
chrome.exe --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir="D:\remotedebugfolder"
Now run the selenium with
options.setExperimentalOption("debuggerAddress","localhost:9222");
On my case this was due because I was using a port (6666) to start my chrome in debug mode, which is restricted according to : restricted [Unsafe] ports list on Chrome
6665, // Alternate IRC [Apple addition]
6666, // Alternate IRC [Apple addition]
6667, // Standard IRC [Apple addition]
A complete chrome list is here and here. Firefox allowed ports here. Also how to force to allow some ports, here
Steps to identify the error
If I startup my chrome in debug mode at port wxyz. I need to validate if this port is correctly used by chrome or just if this port is listening.
Port listening could be validated using telnet localhost wxyz or in windows with nc -zvv localhost wxyz
I found another option to validate if chrome has started successfully using this port. It was a kind of http like http://localhost:wxyz/json/version. If port is listening, a json response is received. If due to some issue like not allowed ports, chrome is not picking this port, http://localhost:wxyz/json/version returns an error. If I found the real endpoint I will update this answer.
If port is listening correctly, another low level error is the reason:
Just check your java code to point to exact port.
Driver exact version. Selenium is very sensitive to the drivers version.
Used browser version compatible with driver version.
Try on linux. In windows some unexpected errors appear.
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.
I'm trying to run tests on Internet Explorer 11 working with Selenium WebDriver.
The code is:
System.setProperty("webdriver.ie.driver", "Path/to//IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
driver.get("www.google.com");
driver.findElement(By.name("q"));
And I get this error:
Started InternetExplorerDriver server (64-bit)
2.46.0.0 Listening on port 43760 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: 15 milliseconds Build info:
version: '2.46.0', revision:
'61506a4624b13675f24581e453592342b7485d71', time: '2015-06-04
10:22:50' System info: host: 'user1-PC', ip: '10.0.23.71', os.name:
'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version:
'1.8.0_45' Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true,
ie.forceCreateProcessApi=false, pageLoadStrategy=normal,
ie.usePerProcessProxy=false, ignoreZoomSetting=false,
handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true,
ie.ensureCleanSession=false, elementScrollBehavior=0,
ie.browserCommandLineSwitches=, requireWindowFocus=false,
browserName=internet explorer,
initialBrowserUrl=http://localhost:43760/, takesScreenshot=true,
javascriptEnabled=true, ignoreProtectedModeSettings=false,
enableElementCacheCleanup=true, cssSelectorsEnabled=true,
unexpectedAlertBehaviour=dismiss}] Session ID:
8a5b7ab5-862a-462d-ab4b-929d4ed5b71a
*** Element info: {Using=name, value=q} 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:204)
at
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:605)
at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:358)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:431)
at org.openqa.selenium.By$ByName.findElement(By.java:300) at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:350)
at MySel20Proj.MySel20Proj.App.main(App.java:42)
I tried to follow the configure tutorial on https://code.google.com/p/selenium/wiki/InternetExplorerDriver but is still not working. And this code works on Firefox and Chrome.
Try going to Internet Options --> Security --> "Enable Protected Mode" on ALL zones should either be checked or ALL unchecked.
There are 2 ways:
Way 1: Setting INITIAL_BROWSER_URL:
File ieFile = new File("D:\\IEDriverServer_x64_2.53.0\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", ieFile.getAbsolutePath());
DesiredCapabilities ieCaps = DesiredCapabilities.internetExplorer();
ieCaps.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, "http://www.bing.com/");
driver = new InternetExplorerDriver(ieCaps);
//some operations on that site
driver.findElement(By.id("sb_form_q")).clear();
driver.findElement(By.id("sb_form_q")).sendKeys("Ripon Al Wasim");
driver.findElement(By.id("sb_form_go")).click();
Way 2: To set a registry entry on the target computer:
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: 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: 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.
For more details you can visit: https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration
I faced the same issue after going through every possible solution finally I got the answer.Try this it will definitely solve your problem as well.
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "IE");
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
System.setProperty("webdriver.ie.driver","C://MavenTest//driver//IEDriverServer.exe");
driver = new InternetExplorerDriver();
For 32-bit Windows: 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: 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 faced the similar issue. I faced while I was running my code in the Maven build. Here in the POM XML file, I had a different version whereas actual selenium installed is another version. So just changed the version so that it matches with the installed version. And Now everything working fine
Ripon Al Wasim posted this url, which is a key to IE11 working with Selenium.
https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration
I had this setup:
Windows 7 Pro 64 bit
IE11 64 bit, latest I found
Selenium remote server 2.53.1 64 bit
IEDriverServer 2.53.1 64 bit
selenium 2.53.1 module installed on 64 bit linux machine used with 64 bit python
downloaded from here: http://selenium-release.storage.googleapis.com/index.html?path=2.53/
I had to follow the guide and to:
Set Enhanced Protected Mode to disabled in all security zones which is a requirement for IE10 and IE11.
Add the FEATURE_BFCACHE key and it's iexplore.exe DWORD into registry
I made all used software to be 64 bit.
Check that zoom in IE is set to 100%.
Check if size of text is 100% in Windows display settings.
Additionaly:
I had to disable proxy settings in IE, because it prevented Selenium remote server to communicate with IEDriverServer.
I am running webdriver with requireWindowFocus set to true, because key typing with 64 bit selenium was slow due some timeout issue (Selenium WebDriver typing very slow in text field on IE browser)
And it worked. I divert from the guide when I specify a path to IEDriverServer.exe when I run standalone server, so it doesn't necessary have to be in the PATH.
Same exception, but in Python. This worked for me:
delay = 30
driver.implicitly_wait(delay)
I am using Selenium to test my website, it opens up a URL using Firefox, logins and does some stuff on the page and then logs out and shuts firefox. That all works great on Windows 7. The code starts with:
WebDriver driver = new FirefoxDriver();
driver.get(URL);
Now I deployed my jar in linux box that runs Debian lenny which has iceweasel on it. A cron job starts the program which throws the following error when trying to open firefox:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect
to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: cannot open display: :0 Error: cannot open display: :0
at
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:106)
at
org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:244)
at
org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:110)
at
org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:190)
at
org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:183)
at
org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:179)
at
org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:92)
at auth.Authenticator.authenticate(Authenticator.java:15) at
reader.ReaderThread.run(ReaderThread.java:67)
org.openqa.selenium.WebDriverException: Failed to connect to binary
FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows:
Error: cannot open display: :0 Error: cannot open display: :0
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: os.name: 'Linux', os.arch: 'i386', os.version:
'2.6.26-2-686', java.version: '1.6.0_26' Driver info: driver.version:
FirefoxDriver at
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
at
org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:244)
at
org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:110)
at
org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:190)
at
org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:183)
at
org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:179)
at
org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:92)
at auth.Authenticator.authenticate(Authenticator.java:15) at
reader.ReaderThread.run(ReaderThread.java:67)
I have Xvfb running ok in the box and I have set variable DISPLAY to 0. I have searched around and none of the solutions (like setting the env variable) worked.
Isnt XVfb supposed to work as a non-graphical environment that the browser will launch into and do the necessary actions? What's stopping it from starting up?
I am using the latest Selenium version 2.31 and Firefox 3.0.6 Iceweasel.
Edit: Updated to Firefox 14 and still see the same issue. I even raised the timeout limit to 60 seconds.
driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
SOLVED: By running it with the xvfb wrapper, xvfb-run like this:
export DISPLAY=:0.0
xvfb-run --auto-servernum --server-num=0 nohup java - jar X.jar
Solved by doing this:
export DISPLAY=:0.0 xvfb-run --auto-servernum --server-num=0 nohup java - jar X.jar
I have seen the similar issue and this is coming only for firefox, for other browser everything was working fine, I tried on Chrome.
Here is the solution for this
1. Check the version of FF, if it is latest, then go for a lesser version of FF. It is recommended for more stability.
2. And you should always try to take latest selenium binary from selenium website.
For more details try this solution:
http://khyatisehgal.wordpress.com/2014/09/09/at-org-openqa-selenium-firefox-internal-newprofileextensionconnection-startnewprofileextensionconnection-java106/
Either try to update your webdriver or downgrade your firefox.
this issue is related that selenium server cannot connect to your firefox.
This issue get resolved after upgraded to the latest Selenium jar.
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.