How to find an element within a frame in IE? - java

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")));

Related

org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status

I am new to Selenium and need some trail to find root cause of the below error.
Selenium version - 3.5.3
ChromeDriver version - 2.29.4
Chrome version - 63
org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status
from unknown error: missing or invalid 'entry.level'
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:42:44.417Z'
System info: host: 'BADRI-HP', ip: '---.---.-.---', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_131'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.29.461591 (62ebf098771772160f391d75e589dc567915b233), userDataDir=C:\Users\Badri\AppData\Local\Temp\scoped_dir45280_30736}, takesHeapSnapshot=true, pageLoadStrategy=normal, unhandledPromptBehavior=, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=63.0.3239.132, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, platformName=XP, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 60b98ca106d00b50963c47e02276c40b
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.ErrorHandler.createThrowable(ErrorHandler.java:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:82)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.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:646)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:370)
at naukri.ProfileUpdate.login(ProfileUpdate.java:19)
at testScripts.NewTest.f(NewTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
The error says it all :
org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status
from unknown error: missing or invalid 'entry.level'
Your main issue is the version compatibility among the binaries you are using as follows :
You are using chromedriver=2.29.461591
Release Notes of chromedriver=2.29.461591 clearly mentions the following :
Supports Chrome v56-58
You are using chrome=63.x
Release Notes of ChromeDriver v2.34 clearly mentions the following :
Supports Chrome v61-63
Release Notes of ChromeDriver v2.35 clearly mentions the following :
Supports Chrome v62-64
You are using Selenium Version 3.5.3.
Your JDK version is 1.8.0_131.
So there is a clear mismatch between the chromedriver version (v2.29.4) [which supports Chrome v56-58] with the Chrome Browser version (v63.x) [supported by ChromeDriver v2.34 minimum]
Solution
Upgrade JDK to recent levels JDK Version 8 Update 151.
Upgrade Selenium to current levels Version 3.8.1.
Upgrade ChromeDriver to ChromeDriver v2.35 level.
Keep Chrome to Chrome v64.x levels. (as per ChromeDriver v2.35 release notes)
Execute your Test.
I fixed this issue after updating chrome driver to 2.38 with chrome version 65.
https://chromedriver.storage.googleapis.com/index.html?path=2.38/
It seems that the ChromeDriver need to be updated. For chrome=63.0.3239.132, you might want to use ChromeDriver v 2.35. You can download the same for your system from:
ChromeDriver v 2.35
Hope it helps.
In my case, it was happening intermittently especially when running in parallel mode. Reducing the thread count to 5 from default (10) fixed my problem.
In my case I was using
selenium-java
3.8.1
I need to update and used the latest version it got resolved
Updated to:
selenium-java
4.3.0

Porting Selenium test from Firefox driver to HTMLUnit driver

I am trying to convert my selenium test from Firefox browser to HTMLUnit driver.
But, when I try to run the HTMLUnit test , it gives me error for XPATH.
The Firefox browser test runs absolutely fine.
My application test suite extensively uses XPATH .
Hence, I am intentionally trying out with XPATH.
I have already tried using
new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated
but still I got the same error.
This is the error :
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate a node using .//*[#id='tsf']/div[2]/div[3]/center/input[1]
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52'
System info: host: 'WL309476', ip: '10.83.16.25', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_66'
Driver info: driver.version: HtmlUnitDriver
at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElementByXPath(HtmlUnitDriver.java:1161)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.htmlunit.HtmlUnitDriver$5.call(HtmlUnitDriver.java:1715)
at org.openqa.selenium.htmlunit.HtmlUnitDriver$5.call(HtmlUnitDriver.java:1)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.implicitlyWaitFor(HtmlUnitDriver.java:1363)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElement(HtmlUnitDriver.java:1711)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElement(HtmlUnitDriver.java:606)
at seleniumtest.Test_Google.main(Test_Google.java:17)
This is my Firefox browser test :
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.co.in/");
WebElement e =driver.findElement(By.xpath(".//*[#id='tsf']/div[2]/div[3]/center/input[1]"));
System.out.println("The current element is " + e.getAttribute("value"));
This is my HtmlUnit test :
WebDriver driver = new HtmlUnitDriver(true);
driver.get("https://www.google.co.in/");
WebElement e =driver.findElement(By.xpath(".//*[#id='tsf']/div[2]/div[3]/center/input[1]"));
System.out.println("The current element is " + e.getAttribute("value"));
I don't think it is a duplicate as there is no javascript involved in my case.
I just want to port a simple test from Firefox driver to HTMLUnit.
Try to apply a little wait for the page to load and then try and locate your element. This is just to be sure that your code didn't execute while the page was still being loaded.
Try something like below,
WebDriver driver = new HtmlUnitDriver(true);
driver.get("https://www.google.co.in/");
Thread.sleep(5000);
WebElement e =driver.findElement(By.xpath(".//* [#id='tsf']/div[2]/div[3]/center/input[1]"));
System.out.println("The current element is " + e.getAttribute("value"));
The Thread.sleep(); will wait for the specified time before executing the next line.
Check with this and see if your element is found or not.
AND
Also check if your web page or the element is dependent on JavaScript. HTMLUnit Driver can't handle JavaScript and lacks of features which normal browsers have.

Unable to find element on closed window on IE 11 with Selenium

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)

Selenium standalone 2.45.0; Scripts crash Firefox 38.0.1

I have used 2.44 with an earlier version of Firefox - it was working fine.
FirefoxDriver ffd = new FirefoxDriver();
ffd.get("www.google.com");
Now, even this simple invocation throws an exception:
Exception in thread "main" org.openqa.selenium.WebDriverException: f.QueryInterface is not a function
Command duration or timeout: 190 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'Shivam-PC', ip: '192.168.0.107', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_31'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=38.0.1, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 19f3d00e-ad14-4fc8-9d29-cee47ae44186
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:599)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:304)
at sele.Sample.main(Sample.java:13)
Caused by: org.openqa.selenium.WebDriverException: f.QueryInterface is not a function
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'Shivam-PC', ip: '192.168.0.107', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_31'
Driver info: driver.version: unknown
at <anonymous class>.FirefoxDriver.prototype.get(file:///C:/Users/Shivam/AppData/Local/Temp/anonymous4862788616202211612webdriver-profile/extensions/fxdriver#googlecode.com/components/driver-component.js:10132)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/Shivam/AppData/Local/Temp/anonymous4862788616202211612webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:12274)
at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/Users/Shivam/AppData/Local/Temp/anonymous4862788616202211612webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:12279)
at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/Users/Shivam/AppData/Local/Temp/anonymous4862788616202211612webdriver-profile/extensions/fxdriver#googlecode.com/components/command-processor.js:12221)
It seems to be common problem from version to version (I faced such kind of problem with FF v.36). Main work around is DO NOT update FF to the newest version (or downgrade if the worst already happened). If your tests work well with particular FF version -> stick with it at least till new version of WebDriver is released.
For myself the most reliable version is FF v.33.
It seems to me that the most robust solution for dealing with Selenium tests on Firefox is to stick with the latest ESR (Extended Support Release) which is mentioned in their CHANGELOG file. The Selenium team has to keep up with the changes introduced in Firefox and that may naturally lead to problems with the most recent versions here and there - not much has changed since the Selenium RC days in this respect.
Update 2016-01-18: There are now two ESR releases mentioned in the CHANGELOG, since with Firefox 33, support for native events has been dropped in favor of synthetic events. The wiki states:
Native events simulate the user interactions better whereas synthetic
events are platform independent, which can be important in Linux when
alternative window managers are used, see native events on Linux.
Native events should be used whenever it is possible.
So depending on your OS, you might try both versions to find the one better suited for you:
For native events: Firefox 31.7.0ESR
For synthetic events: Firefox 38.5.2ESR
Last mention was in Selenium 2.47.0 and included Firefox versions 31, 38 and 39.
If you want to use the latest ESR release no matter what, Mozilla provides a link for that, too.
It is due to your url...change it to http://www.google.com or https://www.google.com
Hope this fixes your problem...Kindly get back if you have any queries

Running Selenium 2.12 fails on Internet Explorer with Java

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.

Categories