Google made an update to Chrome over the weekend and I am trying to run some automated tests using Selenium. Ever since the update, every few 5 or 6 runs results in the following error. I run the test immediately again and it works fine. It's just really annoying because it breaks randomly.
org.openqa.selenium.WebDriverException: org.apache.http.NoHttpResponseException: The target server failed to respond
Build info: version: '2.6.0', revision: '13840', time: '2011-09-13 16:51:41'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_26'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.chrome.ChromeCommandExecutor.execute(ChromeCommandExecutor.java:59)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:377)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:182)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:199)
at org.openqa.selenium.By$ById.findElement(By.java:210)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:174)
at com.core.FindElementAndWait.apply(FindElementAndWait.java:28)
at com.core.FindElementAndWait.apply(FindElementAndWait.java:1)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:173)
... 68 more
I've got a fix for this bug, but it's not been released yet. There's a workaround at https://code.google.com/p/selenium/issues/detail?id=2513 and if you track that issue, you will be notified of the fix's progress.
We have seen the same problem with ChromeDriver. The solution in our case was to add a Thread.sleep(1) between each and every call to the selenium RC API.
For some reason, it solved the issue.
Related
I am sure that my tests are working correctly. When I run the code I got the error in terminal like,
Scenario: User adds new quick work order to employee from website # src/test/java/Features/5NewQuickJobOrder.feature:12
Starting ChromeDriver 111.0.5563.19 (378a38865270d286695aeb86f190564911ef7bc2-refs/branch-heads/5563#{#251}) on port 4290
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 111
Current browser version is 110.0.5481.97 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-CONJ3EC', ip: '192.168.1.27', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '19.0.2'
Driver info: driver.version: ChromeDriver
Recently Chrome updates itself and my version is now 110.0.5481.97. But somehow it tries the run the test with version 111 shows below. I have no version in my computer such that starts with 111..
Scenario: User adds new quick work order to employee from website # src/test/java/Features/5NewQuickJobOrder.feature:12
Starting ChromeDriver 111.0.5563.19 (378a38865270d286695aeb86f190564911ef7bc2-refs/branch-heads/5563#{#251}) on port 40758
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
I do not use any chromedriver exe in my project folder, I directly use setup and driver intsance.
public static WebDriver initialize_Driver(String browser) {
properties = ConfigReader.getProperties();
if (browser.equals("Chrome")) {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
}
#Before
public void before() {
String browser = Reporter.getCurrentTestResult().getTestContext().getCurrentXmlTest().getParameter("browser");
properties = ConfigReader.initialize_Properties();
driver = DriverCreater.initialize_Driver(browser);
}
I will be very glad, if you could help me!
First the solution
To instantiate a specific browser version of ChromeDriver you can use:
WebDriverManager.chromedriver().driverVersion("111.0.5563.19").setup();
Details
This error message...
org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 111
...implies that SessionNotCreatedException was raised as ChromeDriver was unable to spawn a new Browsing Context i.e. google-chrome session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chrome=110.0.5481.97
But you are using chromedriver=111.0.5563.19
Release Notes of chromedriver=111.0 clearly mentions the following :
Supports Chrome version 111
So there is a clear mismatch between chromedriver=111.0 and the chrome=110.0
Solution
Ensure that:
ChromeDriver is downgraded to ChromeDriver v110.0 level.
Chrome Browser is updated to current chrome=110.0 (as per chromedriver=110.0 release notes).
Selenium is upgraded to current released Version 4.8.0.
Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987#{#882}) on port 37201
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 80
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'DELL', ip: '192.168.43.201', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.8.0_221'
Driver info: driver.version: ChromeDriver
remote stacktrace: Backtrace:Ordinal0 [0x01510C83+1707139]
Ordinal0 [0x014768F1+1075441]
Ordinal0 [0x013EDFC9+516041]
Ordinal0 [0x01380554+66900]
The version of google chrome browser on your system should be same as your chrome driver version.
Goto Google Chrome -> Help -> About Google Chrome to check chrome version.
Then download the same version chromedriver from here: https://chromedriver.chromium.org/downloads
I have recently updated ChromeDriver to 2.36 after chrome was auto updated to v65.
But on running test now i am getting below exceptions
Starting ChromeDriver 2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91) on port 10482
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: failed to write automation extension zip
(Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 218 milliseconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: '172.16.27.222', ip: '172.16.123.114', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_77'
Driver info: driver.version: ChromeDriver
Have tried both chromeOptions & DesiredCapabilties
ChromeOptions o = new ChromeOptions();
o.addArguments("disable-extensions");
o.addArguments("--start-maximized");
ChromeDriver chromeDriver = new ChromeDriver(o);
return chromeDriver;
Also tried below method :
ChromeDriver chromeDriver = new ChromeDriver(capabilities);
chromeDriver.manage().window().maximize();
The error says it all :
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: failed to write automation extension zip
(Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 218 milliseconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: '172.16.27.222', ip: '172.16.123.114', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_77'
Driver info: driver.version: ChromeDriver
It is clear from your error stack trace that the driver.version is not getting recognized.
Your main issue is the version compatibility between the binaries you are using as follows :
You are using chromedriver=2.36
You are using chrome=65.0 (as per your question)
You are using Selenium Client v3.11.0
Your JDK version is 1.8.0_77 which is pretty ancient.
So there is a clear mismatch between the JDK v8u77 , Selenium Client v3.11.0 , ChromeDriver version (v2.36) and the Chrome Browser version (v65.0)
Solution
Upgrade JDK to recent levels JDK 8u162.
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.
If your base Chrome version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Chrome.
Execute your #Test.
Additional Considerations
If you intend to use ChromeDriver and Chrome Browser, while initializing the WebDriver instance instead of using the ChromeDriver implementation use the WebDriver interface as follows :
WebDriver chromeDriver = new ChromeDriver(o);
If you intend to maximize the browser window, instead of using chromeDriver.manage().window().maximize(); use the ChromeOptions instance as follows :
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
Here are the arguments I use:
ArrayList<String> args = new ArrayList<String>();
args.add("enable-automation");
args.add("test-type=browser");
args.add("disable-plugins");
args.add("disable-infobars");
args.add("disable-extensions");
options.put("args", args);
I think you need to at least add the "enable-automation" argument.
I have tests that were perfectly working in Chrome 60 and ChromeDriver 2.31, but after Chrome updated to 61 version I had to update ChromeDriver to 2.32. And now I am getting sporadic org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (X, Y) - in all tests that are run for mobile device emulators such as "iPhone 6 Plus" browser mode,
for example.
As a workaround I would probably use scroll to element before the click, but it's just a quick fix and it's better to know where this issue comes from. Is it the issue of the current latest Chrome and driver releases? Is it going to be fixed soon?
Issue is reproduced on both local and remote webdriver.
Stacktrace:
org.openqa.selenium.WebDriverException: unknown error: Element is not
clickable at point (182, 3724) (Session info: chrome=61.0.3163.91)
(Driver info: chromedriver=2.32.498550
(9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows NT
10.0.15063 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 115 milliseconds Build info:
version: '3.4.0', revision: 'unknown', time: 'unknown' System info:
host: 'xxx', ip: '10.100.8.33', os.name: 'Windows 10', os.arch:
'amd64', os.version: '10.0', java.version: '1.8.0_131' Driver info:
org.openqa.selenium.chrome.ChromeDriver Capabilities
[{applicationCacheEnabled=false, rotatable=false,
mobileEmulationEnabled=true, networkConnectionEnabled=false,
chrome={chromedriverVersion=2.32.498550
(9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),
userDataDir=C:\Users\xxx\AppData\Local\Temp\scoped_dir5912_31757},
takesHeapSnapshot=true, pageLoadStrategy=normal,
databaseEnabled=false, handlesAlerts=true, hasTouchScreen=true,
version=61.0.3163.91, platform=XP, browserConnectionEnabled=false,
nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true,
webStorageEnabled=true, browserName=chrome, takesScreenshot=true,
javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true,
unexpectedAlertBehaviour=dismiss}] Session ID:
2ead932fef8d0d923286ac41c8fffe50 Command duration or timeout: 257
milliseconds
I guess it relates to https://bugs.chromium.org/p/chromedriver/issues/detail?id=1852
Chrome driver Developers are aware that the fix is not working properly in mobile device emulate mode. A fix for that is coming in ChromeDriver 2.33.
you need to downgrade your chrome version to 59.0 (32 bit), as there is some with issue with the new chrome update.
or
you need to scroll to element first and then try to click
I am not absolutely sure but your issue sounds very much like mine one. My tests appeared to be not able to scroll to the element using the built-in move_to_element() Selenium method after my browser was updated.
Here is my workaround written in python
def scroll_to_element(element):
self.driver.execute_script("window.scrollTo(0, %d);" %
element.location['y'])
As a temporary solution – try to scroll to the element an then try to click it. Hope this helps you for now.
There are alternate solution for this:
First maximize the window:
driver.manage().window().maximize();
Second, You can use the Action class to moveToElementmethod and access it
WebElement element = driver.findElement(By("element"));
Actions action = new Actions(driver);
action.moveToElement(element).click().perform();
try to click using javascript its works for me.
WebElement element = driver.findElement(By.id("gbqfd"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
I have the same problem (movetoelement does nothing in mode movilemulation with chromedriver2.32 and Chrome61+) and the only solution for me was back to Chrome60. You can obtains older versions of chrome in
https://www.slimjet.com/chrome/google-chrome-old-version.php
When chromedriver2.33 arrives then i will test again against Chrome61+
My functional test running on hudson every 5 mins. It's working fine except almost(not always) every morning around 6:00 clock(I checked system logs, there is no big jobs eating up system resources at that time), I get java.lang.ExceptionInInitializerError caused by org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary on port 7055; then the build will hang there forever.
I use gradle to run the geb/webdriver tests, the gradle build seems to start and run until the test step.
I saw this thread http://groups.google.com/group/webdriver/browse_thread/thread/3d0bbb40cce5dfac but that seem can not solve my problem.
Any idea how to fix this? Now I have to get up and stop the failure build
every morning..
Thanks a lot in advance.
System info: os.name: 'Windows 2003', os.arch: 'amd64', os.version: '5.2', java.version: '1.5.0_18' Driver info: driver.version: FirefoxDriver
The url to thread you refer to seems to be faulty.
I have been having troubles with gradle hanging now and again. Those cases seem to have been due to an unreleased lock in the .gradle directory in the user home directory. Removing the .gradle directory fixed it for me.