System.setProperty("webdriver.ie.driver", "D:\Selenium\jars\IEDriverServer\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("http://the-internet.herokuapp.com");
driver.findElement(By.linkText("Forgot Password")).click();
Thread.sleep(3000);
driver.findElement(By.id("email")).sendKeys("testmail#mail.com");
when i run the above code it is working fine with chrome and firefox but when i run using IE it is throwing below error when running 7th step don't understand y it is not working in IE.
Could some one please help me in resolve this issue. Thanks in advance
Nov 20, 2017 2:58:39 PM org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'no such window' (400 expected)
org.openqa.selenium.NoSuchWindowException: Currently focused window has been closed.
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'ML-SIVAKUMARS-P', ip: '192.168.12.159', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{proxy=Proxy(), acceptInsecureCerts=false, browserVersion=11, se:ieOptions={nativeEvents=true, browserAttachTimeout=0, ie.ensureCleanSession=false, elementScrollBehavior=0, enablePersistentHover=true, ie.browserCommandLineSwitches=, ie.forceCreateProcessApi=false, requireWindowFocus=false, initialBrowserUrl=http://localhost:2761/, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, ignoreProtectedModeSettings=false}, timeouts={implicit=0, pageLoad=300000, script=30000}, browserName=internet explorer, pageLoadStrategy=normal, javascriptEnabled=true, platformName=WINDOWS, setWindowRect=true, platform=WINDOWS}]
Session ID: 24a4d291-482e-4399-98fc-f2037c4da5bb
*** Element info: {Using=id, value=email}
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.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:185)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:120)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:356)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:402)
at org.openqa.selenium.By$ById.findElement(By.java:218)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:348)
at com.org.learning.tests.TestDayTwo.firstTest(TestDayTwo.java:38)
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)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
I have been struggling with the same problem since yesterday and finally got my test to work.
Check if you have all the required configurations for the InternetExplorerDriver. For me it was the protected mode settings which I finally tested even though I am on Win 10.
Hope it helps you, too.
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.
Note: 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
Error resolved in my case after enabling protected mode in internet explorer.
Settings--> internet options-->security --> check Enbale protected mode for all the zones.
There are three Settings :
Zoom level set to 100%
Unchecked the Internet Options --> Security--> For Internet and Trusted sites
Unchecked "Enable Protected Mode"
In my case I was getting the error due to missing slash at last of URL "/"
Actual is http://example.com/
but I was passing http://example.com
Related
I am new to Automation and trying to learn Automation as a manual tester. I am trying to execute a simple java code to open a Chrome browser using Selenium Webdrivers and get the below exception. Tried all possible ways to resolve the same and still nothing works. Any help would really help. Thanks.
Starting ChromeDriver 2.28.455520 (cc17746adff54984afff480136733114c6b3704b) on port 3527
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 4.67 seconds
Build info: version: '2.51.0', revision: '1af067d', time: '2016-02-05 19:11:55'
System info: host: 'BTP196816', ip: '10.241.51.20', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.7.0_99'
Driver info: org.openqa.selenium.chrome.ChromeDriver
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:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:159)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:116)
at OpenAdf.LaunchAdf.main(LaunchAdf.java:11)
try using that :
System.setProperty("webdriver.chrome.driver", "C:\\SeleniumDrivers\\chromedriver_win32\\chromedriver.exe");
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability("binary", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
WebDriver driver = new ChromeDriver(capability);
You can also try
capability.setCapability("chrome.binary", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
Hope it helps.
System.setProperty("webdriver.chrome.driver", "C:\\SeleniumDrivers\\chromedriver_win32\\chromedriver.exe");
Need to set the chrome driver path and the chrome driver path must be at the location which you gave in the code.
I'm running a bunch of test cases every hour using selenium-java 3.12.0; TestNG; Selenoid with docker, Jenkins.
Sometimes (about 1 out of 10 cases) I get the error:
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'autotest.rvkernel.com', ip: '94.130.165.217', os.name: 'Linux', os.arch: 'amd64', os.version: '4.13.0-26-generic', java.version: '1.8.0_181'
Driver info: driver.version: RemoteWebDriver
Capabilities [{mobileEmulationEnabled=false, hasTouchScreen=false, platform=LINUX, acceptSslCerts=false, acceptInsecureCerts=false, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, platformName=LINUX, setWindowRect=true, unexpectedAlertBehaviour=, applicationCacheEnabled=false, rotatable=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf), userDataDir=/tmp/.org.chromium.Chromium.gURWcu}, takesHeapSnapshot=true, pageLoadStrategy=normal, unhandledPromptBehavior=, databaseEnabled=false, handlesAlerts=true, version=67.0.3396.62, browserConnectionEnabled=false, nativeEvents=true, locationContextEnabled=true, cssSelectorsEnabled=true}]
Session ID: 56c4b100a95d89b3d5702ec8a1a0698a
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:564)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:276)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)
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)
at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement$1.invoke(EventFiringWebDriver.java:376)
at com.sun.proxy.$Proxy14.click(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.click(EventFiringWebDriver.java:389)
at com.Elements.Element.lambda$click$2(Element.java:99)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
at com.Elements.Element.click(Element.java:98)
at com.Elements.Element.click(Element.java:78)
at com.pages.landing.social.MailRuRegisterPage.clickRegister(MailRuRegisterPage.java:37)
at RulVulaknTests.authorization.AuthorizationTest.authorizationUserFromMailRU(AuthorizationTest.java:100)
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)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:571)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Cannot decode response content:
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:83)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
... 28 more
Caused by: org.openqa.selenium.json.JsonException: java.io.EOFException: End of input at line 1 column 1 path $
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'autotest.rvkernel.com', ip: '94.130.165.217', os.name: 'Linux', os.arch: 'amd64', os.version: '4.13.0-26-generic', java.version: '1.8.0_181'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.json.JsonInput.execute(JsonInput.java:172)
at org.openqa.selenium.json.JsonInput.peek(JsonInput.java:72)
at org.openqa.selenium.json.JsonTypeCoercer.lambda$null$6(JsonTypeCoercer.java:136)
at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:122)
at org.openqa.selenium.json.Json.toType(Json.java:62)
at org.openqa.selenium.json.Json.toType(Json.java:52)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
... 31 more
Caused by: java.io.EOFException: End of input at line 1 column 1 path $
at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1401)
at com.google.gson.stream.JsonReader.consumeNonExecutePrefix(JsonReader.java:1576)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:534)
at com.google.gson.stream.JsonReader.peek(JsonReader.java:425)
at org.openqa.selenium.json.JsonInput.lambda$peek$0(JsonInput.java:73)
at org.openqa.selenium.json.JsonInput.execute(JsonInput.java:168)
... 37 more
And after this error all remained tests are skipped.
Versions of chrome browser using which I have encountered the error - 66, 67.
This error message...
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
...implies that the RemoteWebDriver instance was closed abruptly.
Your code trials would have been of some help to debug the issue. Perhaps yout main issue can be one of the following:
You have mentioned that you are using selenium-java 3.12.0 but your error trace logs mentions about selenium-java 3.6.0. So possibly there are multiple instances of selenium-java referenced within this project. So you need to ensure that your project is configured with only one set of selenium-java binaries.
As per best practices:
Upgrade Selenium to current levels Version 3.14.0.
Upgrade ChromeDriver to current ChromeDriver v2.41 level.
Keep Chrome version between Chrome v66-68 levels. (as per ChromeDriver v2.41 release notes)
(WindowsOS only) Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite.
(LinuxOS only) Free Up and Release the Unused/Cached Memory in Ubuntu/Linux Mint before and after the execution of your Test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
As you have mentioned running a bunch of test cases every hour possibly there are multiple dangling instances of ChromeDriver and Chrome which can be viewed through the process list (Linux OS) or TaskManager (Windows OS). You need to always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
If the dangling instances of WebDriver and Web Browser still persists consider killing them with brute force. You can find a detailed discussion in Selenium : How to stop geckodriver process impacting PC memory, without calling driver.quit()?
Incase you program is attempting to set up TCP connections from ports that are greater than 5000 you can refer this article
References
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Getting "Error communicating with the remote browser. It may have died." with chromedriver
IE11: UnreachableBrowserException: Error communicating with the remote browser. It may have died.
WebDriver fix for UnreachableBrowserException
sorry for the reply to very old questions, but thought it could help someone else.
I was facing the same problem, and earlier I also thoughts issue is with Webdriver but it was not the case,
public static final Target EMAIL = Target.the("email")
.locatedBy(("//input[(#id='login-email-input')]"));
And everything was working fine with,
actor.attemptsTo(Enter.keyValues("someemail#gmail.com")
.into(EMAIL).thenHit(Keys.TAB));
but I thought to clear the input box before enter the new value and replaced above line with,
actor.attemptsTo(Clear.field(EMAIL));
actor.attemptsTo(Enter.keyValues("someemail#gmail.com")
.into(EMAIL).thenHit(Keys.TAB));
And I got the same error. After removing newly added line, things started working correctly.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: unable to discover open page
Browser is opening but the desired web page is NOT opening & browser is is getting closed within 5secs.
After this the exception is showing up in IDE.
Attached the screenshot of the the browser This is how the browser looks when it opened
Tried uninstalling (deleted user data also)& reinstalling chrome, but din't work :(
Using
JDK 8,
selenium 3.6.0 for Java,
chrome browser-Latest version,
chrome driver-not sure(may be 2.31)
My code
package newPackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class MyClass {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\ChromeDriver_Selenium\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://google.com");
}
}
OUTPUT I am seeing
Starting ChromeDriver (v2.3) on port 20165
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: unable to discover open pages
(Driver info: chromedriver=2.3,platform=Windows NT 6.3 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.55 seconds
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:26.402Z'
System info: host: 'DESKTOP-9KFNBI3', ip: '192.168.0.104', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: ChromeDriver
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:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140)
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 newPackage.MyClass.main(MyClass.java:10)
Issue might be due to your chrome driver.Get the chrome driver and set the path in your code and try your code again.Let me know if you are able to overcome this issue.
Use the below link to get latest version of chrome driver(2.33)
From google:
https://sites.google.com/a/chromium.org/chromedriver/downloads
[OR]
From Selenium downloads:
http://www.seleniumhq.org/download/
After some experimentation, I'd agree about ensuring that the chromedriver executable is on your path. You may find that the setting of the system property may be unnecessary.
I don't see any such error in your code.
The error you are observing is because of the Versioning mismatch. You are using Selenium v3.6.0 and chromedriver v2.3 (which is pretty old) and are not compatible.
Solution:
As you are working with the latest version of Selenium i.e. v3.6.0, I would suggest you to use either chromedriver v2.32 or the latest chromedriver v2.33
you are using very old version of ChromeDriver so that it is not compatible with Selenium jars 3.6.0 and browser , use updated ChromeDriver and these issue is resolved.
This issue occurred when your ChromeDriver doesn't support the Browser. Download Latest ChromeDriver from this Link.
or
You can degrade the Chrome browser which is compitable with ChromeDriver 2.31
Update your Chrome Driver to the latest one
I'm not able to select any dropdown in firefox browser when using selenium 3 beta 2. I'm getting :
element not visible exception
Here are some more details:
StackError:
org.openqa.selenium.ElementNotVisibleException: Element is not visible (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 15 milliseconds
Build info: version: 'unknown', revision: '2aa21c1', time: '2016-08-02 14:59:43 -0700'
System info: host: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, appBuildId=20160817112116, version=, platform=XP, proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false, browserVersion=48.0.1, platformVersion=10.0, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=Windows_NT, device=desktop}]
Session ID: 1bdaa5b9-a2b8-47aa-81b8-5516c39462a7
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:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:683)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:319)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:85)
at org.openqa.selenium.support.ui.Select.setSelected(Select.java:324)
at org.openqa.selenium.support.ui.Select.selectByValue(Select.java:201)
at DriverTest.test(DriverTest.java:45)
While for chrome browser, it is perfectly working fine.
I think there is some issue with firefox browser. Currently i can see that firefox can be updated to 48.0.2. Do we have a fix for this yet?
You should use WebDriverWait if you are not using it.With WebDriverWait the code should be like
Select sel = new Select(new WebDriverWait(driver,30).until(ExpectedConditions.visibilityOfElementLocated(By.name("country"))));
sel.selectByVisibleText("Albania");
I am unable to identify any of webelements in a page using Selenium webdriver. Used 2.48.0 selenium jar. I have tried xpath absolute, relative path, css selector, id, name. All throwing NoSuchElementException. I am stucked here. please help me. I am able to login to application easily After login selecting a menu items will direct to a page. On that page, Will not be able to identify any elements.
Please find text box i am trying to enter
html source:
<input class="AnswerText" type="text" onblur="$('#ind6').attr('class','ALIP-Icon sprite-icon_indicator_off'); " onfocus="gotFocus(this);$('#ind6').attr('class','ALIP-Icon sprite-icon_indicator'); removeFocus('ind6'); " maxlength="15" size="15" value="" name="7:/XML/ApplicationSummary/ContractNumber">
Console ErrorError:
Started InternetExplorerDriver server (64-bit)
2.48.0.0
Listening on port 43801
org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == /html/body/div/div/div/form/div[1]/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td[2]/div[2]/span/table/tbody/tr[1]/td[1]/div/div/table/tbody/tr/td[3]/input (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 377 milliseconds
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:59:12'
System info: host: 'V-INFSY-NBA121', ip: '172.30.1.102', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=false, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=true, handlesAlerts=true, version=9, platform=WINDOWS, nativeEvents=false, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:43801/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 38d52e22-4575-49b3-aaf4-25a96a7d177a
*** Element info: {Using=xpath, value=/html/body/div/div/div/form/div[1]/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td[2]/div[2]/span/table/tbody/tr[1]/td[1]/div/div/table/tbody/tr/td[3]/input}
at sun.reflect.GeneratedConstructorAccessor9.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:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:353)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:490)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:345)
at com.onfs.test.CommonMethods.type(CommonMethods.java:558)
at com.onfs.test.Application_Entry.testMethod(Application_Entry.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
I think there is sync issue. I would wait for that element to appear before start sending value. Please use following code and try to run. It should work.
I replace xpath to by name or you can try with Class too. You have really big xpath. In my view it is not good to have that long.
WebDriverWait wait = new WebDriverWait(driver, timeoutWait);
wait.until(ExpectedConditions.visibilityOf(By.name("7:/XML/ApplicationSummary/ContractNumber"))).sendKeys("1234567")
Detail documentation of WebDriverWait
Can you try the same with by disabling protective mode? lets do below way and may i know what is issue if still you are facing and also provide code
go for IEDriverServer.exe 32 bit and use the same
un-check all the zones in security tab
try with short xpath specified in another answer if yours does not works
try without waits first, wait, if it fails then thread.sleep
thanks