geb.driver.DriverCreationException: failed to create driver from callback - selenium

I am getting below Exception while running test scripts.
geb.driver.DriverCreationException: failed to create driver from callback 'script1501516684770944233575$_run_closure1#6601cc93'
java.lang.NoClassDefFoundError: Lorg/openqa/selenium/remote/html5/RemoteWebStorage;
failed to create driver from callback 'script1501516684770944233575$_run_closure1#6601cc93'
OS: Windows 10 64 bit
Chrome browser: v60 (latest one)
Selenium :-2.43.1
Chrome web driver:-2.24.417431
geb-version:0.10.0
geb-testng-version:0.13.1
geb-spoc-version:0.13.1
Thanks in Advance...!

This will be a version issue (your old web driver is not compatible with newer chrome versions). If you are using the latest version of chrome, I suggest moving to the latest version of selenium and chrome driver.
Infact one quick google suggests that I might be right: https://sites.google.com/a/chromium.org/chromedriver/downloads
Latest Release: ChromeDriver 2.31
Supports Chrome v58-60

This error can be thrown if you do not correctly define your chrome driver location when executing your tests.
Either in your GebConfig:
driver = {
System.setProperty('webdriver.chrome.driver', '/Users/foo/drivers/chromedriver')
new ChromeDriver()
}
Or in something like VM parameters if running from an intelliJ Run/Debug Configuration:
-Dbrowser=chrome -Dwebdriver.chrome.driver="/Users/foo/drivers/chromedriver/chromedriver.exe"

I was having this problem for a couple of days and finally understand the cause. This problem occurred for me on Jenkins when I am setting my browser to chrome or firefox and then trying to run my tests. It occurred due to browsers not installed on Jenkins machine. The drivers are present in the code but the browser should be installed on machine otherwise Geb will throw this error. Hope this helps.

Related

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80

when i go to command prompt and type chromedriver -v:
ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945#{#614})
but when i try to run this code :
from selenium import webdriver
class InstaBot:
def __init__(self):
self.driver=webdriver.Chrome()
self.driver.get("www.instagram.com")
InstaBot()
it gives me error like this:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80
why this is happening i tried to remove selenium as well as chromedriver
and reinstall of version 79.0.3945 but when i run it ,it show this can only be run on version 80
my chrome version is 79.0.3945 which is lastest ,and version 80 chrome is chrome beta
This error message...
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80
...implies that the ChromeDriver v80.0 was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You mentioned about using chromedriver=79.0.3945.36 and the release notes of chromedriver=79.0 clearly mentions the following :
Supports Chrome v79
Presumably you are using chrome v79.0 browser.
So, it's quite evident your have chromedriver=80.0 present within your system which is also within the system PATH variable and is invoked while you:
self.driver=webdriver.Chrome()
Solution
There are two solutions:
Either you upgrade chrome to Chrome Version 80.0 level. (as per ChromeDriver v80.0 release notes)
Or you can override the default chromedriver v80.0 binary location with chromedriver v79.0 binary location as follows:
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe')
driver.get('http://google.com/')
You can find a detailed discussion in Ubuntu: selenium.common.exceptions: session not created: This version of ChromeDriver only supports Chrome version 79
Additional Considerations
Ensure to:
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test as non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
Reference
You can find a relevant detailed discussion in:
How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium
Use Bonigarcia plugin in project. After that it will manage all driver by itself.It reads chrome version and instantiate driver accordingly.
for help follow my post :
https://www.linkedin.com/pulse/webdrivermanager-bonigarcia-rohan-ravi-yadav/
or original git link/post
https://github.com/bonigarcia/webdrivermanager
If any help required , Let me know

Getting Timed out receiving message from renderer: 600.000 When we execute selenium scripts using Jenkins windows service mode

We are executing our selenium automation script using jenkins window service(Headless mode) on daily basis .it was working fine till yesterday. suddenly it stopped working and not launching the browser. it shows the below error message [1553677874.187][SEVERE]: Timed out receiving message from renderer: 600.000. after that all the remaining test cases are getting failed.
It is working fine if we run the build using jenkins as without windows service. We are experiencing this issue only with windows as service
My chrome driver version :73.0.3683.68
Chrome browser version :73.0.3683.68
Selenium Version :3.14.0
I have tried to downgrade the browser version and driver version. even though it is not working
I am expecting the browser should launch in the background when we execute using jenkins as windows service but getting error message.
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("load-extension=C:\\1.13.4_0");
options.addArguments("--start-maximized");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--disable-popup-blocking");
// options.addArguments("window-size=1400,600");
options.addArguments("enable-automation");
options.addArguments("--headless");
options.addArguments("--window-size=1920,1080");
options.addArguments("--no-sandbox");
// options.addArguments("--disable-extensions");
options.addArguments("--dns-prefetch-disable");
options.addArguments("--disable-gpu");
options.setPageLoadStrategy(PageLoadStrategy.NORMAL);
DesiredCapabilities capabilities =
DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY,
**strong text**options);
return new ChromeDriver(capabilities);
Seems you are using the following configuration:
chromedriver=73.0.3683.68
chrome=73.0.3683.68
Windows OS
John Chen (Owner - chromedriver) recently have confirmed that,
We have confirmed issues with take screenshot when Chrome 73.0.3686.75 is started by a service (such as Jenkins or Task scheduler) on Windows. Please see https://crbug.com/942023 for more details. We apologize for any inconvenience caused by this. However, we haven't yet been able to observe similar issue on Linux, so we appreciate any help you can provide to enable us to reproduce the issue on Linux. We don't have access to TeamCity, but we have tested take screenshot using Docker image produced by Selenium (selenium/standalone-chrome:3.141.59-lithium), and didn't find any problems.
Yesterday (Mar 26, 2019), John once again confirmed:
I am aware of some issues with running Chrome 73 from Jenkins. I don't know any workarounds. Please following https://crbug.com/942023 for updates.
Update
We were able to dig up the main issue. The main issue is not with ChromeDriver v73.x as such but with Chrome v73.x and John officially confirms it as:
The root cause is indeed in Chrome 73.x, not in ChromeDriver. We are working with Chrome devs to find a solution.
Solution
A quick fix solution will be to:
Downgrade Chrome Browser to Chrome v72.x
Use a matching ChromeDriver among:
ChromeDriver 2.46
ChromeDriver 72.0.3626.69
Note: If you are using Chrome version 72, please download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69
Ensure that JDK is upgraded to recent level of JDK 8u202.
Outro
You can find the relevant discussions in:
Page.captureScreenshot no longer works in Chrome 73 under Selenium as a Service on Windows
Error [SEVERE]: Timed out receiving message from renderer: 20.000 while executing the testsuite through Selenium on Jenkins
Download Google Chrome 72 Offline Installer For All Operating Systems
Update(03-April-2019)
Adding the argument --disable-features=VizDisplayCompositor through an instance of ChromeOptions() seems solves the issue:
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-features=VizDisplayCompositor");
WebDriver driver = new ChromeDriver(options);
driver.get("https://google.com");
Possible problem is that your Google Chrome updated and became incompatible with your Chromedriver. I suggest either getting a new Chromedriver or downgrading your Google Chrome to a previous version and disabling auto updates.
You can verify the required Chromedriver version for your Google Chrome here:
http://chromedriver.chromium.org/downloads
Step 4 of the following link worked for me to disable automatic google Chrome updates.
https://www.webnots.com/7-ways-to-disable-automatic-chrome-update-in-windows-and-mac/
Add below property(1) before ChromeDriver initialization
System.setProperty("webdriver.chrome.silentOutput", "true");
driver = new ChromeDriver();

Post Firefox upgrade to version 60.3.0, not able to run automation tests

We are using robot framework for automation testing in our project. We were using Firefox version 47, gecko driver version 0.16.0 and selenium 3.14 and were able to run all the tests successfully.
Recently, IT team decided to upgrade Firefox to 60.3.0 and now automation is failing with error as:
SessionNotCreatedException: Message: Unable to find a matching set of capabilities.
Tried using geckodriver versions 0.21, 0.22, 0.24 but in vain. Receiving same error.
Any help or insights would be appreciated.
This error message...
SessionNotCreatedException: Message: Unable to find a matching set of capabilities.
...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowser i.e. Firefox Browser session.
Your main issue is the incompatibility between the version of the binaries you are using.
It is not clear from your question which combination of Selenium, GeckoDriver and Firefox combination produced the mentioned error. However as per best practices always follow the GeckoDriver, Selenium and Firefox Browser compatibility chart below:

Jmeter WebDriver don't start

I tried to run WebDriver Sampler, but got problem with driver config.
First I tried to use Firefox Driver Config. When run only Firefox Driver Config (without any sampler) I see how Firefox launched but finally got error:
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055; process output follows: ddons.json found.
Next I tried to use Chrome Driver config, but got error:
The driver executable does not exist.
I tried to solve the problem like this: How to solve this error an jmetere, but it doesn’t work.
Image with config and errors
With regards to Firefox you need to ensure that you use supported Firefox version. The latest JMeter WebDriver Plugin kg.apc:jmeter-plugins-webdriver:2.3 has transitive dependency on the selenium-firefox-driver:2.52.0 which means that you can use Firefox 45 or earlier with it.
Later Firefox versions will not work.
You can download Firefox 45 from Mozilla FTP website
More information: Q. How do I Know Which Browsers are Supported? chapter of The WebDriver Sampler: Your Top 10 Questions Answered guide
I found the tab with configuration path to driver
Picture with tab:

Only local connections are allowed Chrome and Selenium webdriver

I am using Chrome webdriver 2.23 & Selenium 2.53.1.
I have tried a lot, but could not get it fixed. Whenever I run my selenium script, it is giving me the following error
Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 12162
Only local connections are allowed.
This is just an informational message. Your issue might be a missmatch between the versions of chromedriver and selenium-server-standalone.
Try with the latest selenium version 3.0, it is working for me.
Please not that for selenium 3.0 you need to specify the driver first and after the selenium server.
With the new selenium, which is 3.0 you should use:
java -Dwebdriver.chrome.driver=path_to_chrome_driver -jar selenium-server-standalone-3.0.0-beta2.jar
If you are using selenium version below 3.0 you need to reverse the order of selenium with the driver, like:
java -Dwebdriver.chrome.driver=path_to_chrome_driver -jar selenium_server.jar
When you are starting the selenium server, open a console in the directory with chromedriver and selenium server and execute the above command.
Here you are a working stack:
Some previous notes:
If you run selenium in a non graphical enviromnent, xvfb is required.
You will need selenium-server-standalone-2.53.1.jar (working version). You can download selenium versions here: http://selenium-release.storage.googleapis.com/index.html
You will also need chromedriver v 2.27. Download link: https://chromedriver.storage.googleapis.com/index.html
1) Run sudo Xvfb :10 -ac &
2) Run export DISPLAY=:10
3) Run java -jar "YOUR_PATH_TO/selenium-server-standalone-2.53.1.jar" -Dwebdriver.chrome.driver="YOUR_PATH_TO/chromedriver.2.27" -Dwebdriver.chrome.whitelistedIps="localhost"
First off, What you are seeing is not an error. It is an informational message.
When you run this driver, it will enable your scripts to access this and run commands on Google Chrome.
This can be done via scripts running in the local network (Only local connections are allowed.) or via scripts running on outside networks (All remote connections are allowed.). It is always safer to use the Local Connection option. By default your Chromedriver is accessible via port 9515.
See this answer if you wish to allow all connections instead of just local.
If your Chromedriver only shows the above two messages (as per the question), then there is a problem. It has to show a message like this, which says it started successfully.
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103#{#416}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
To troubleshoot this...
Step 1: Check your Chromedriver version
$ chromedriver --version
ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103#{#416})
My version is 83.0.4103.39.
Step 2: Check your Chrome Browser version
Open Google Chrome.
Options --> Help --> About Google Chrome
Or open a terminal and run the following command (works on Ubuntu).
$ google-chrome --version
Google Chrome 83.0.4103.61
My version is: Version 83.0.4103.61
Step 3: Compare versions of Chromedriver and Google Chrome
Both these versions are starting with 83, which means they are both compatible. Hence, you should see a message like below, when you run the below command.
$ chromedriver
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103#{#416}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
If your versions mismatch, then you will see the following message. You will not see the line which says, ChromeDriver was started successfully..
$ chromedriver
Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987#{#882}) on port 9515
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Step 4: Download the correct version of Chromedriver
Download the correct version that matches your browser version. Use this page for downloads. After you download, extract the content, and move it to one of the following two folders. Open each of the following two folders and see whether your current Chromedriver is there. If it is on both folders, replace both. And do STEP 3 again.
/usr/bin/chromedriver
/usr/local/bin/chromedriver
Check the version of your installed Chrome browser.
Download the compatible version of ChromeDriver from
https://sites.google.com/a/chromium.org/chromedriver/
Set the location of the compatible ChromeDriver to:
System.setProperty("webdriver.chrome.driver", "C:\\Users\\your_path\\chromedriver.exe");
Run the Test again.
It should be good now.
You need to pass --whitelisted-ips= into chrome driver (not chrome!). If you use ChromeDriver locally/directly (not using RemoteWebDriver) from code, it shouldn't be your problem.
If you use it remotely (eg. selenium hub/grid) you need to set system property when node starts, like in command:
java -Dwebdriver.chrome.whitelistedIps= testClass etc...
or docker by passing JAVA_OPTS env
chrome:
image: selenium/node-chrome:3.141.59
container_name: chrome
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
- JAVA_OPTS=-Dwebdriver.chrome.whitelistedIps=
I followed my frnd suggestion and it worked like a gem for me:
Working Code:
1) Downloaded chromedriver.
2) Code is
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Sel {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Downloads\\chromedriver_win32\\chromedriver.exe"); // path of chromedriver
WebDriver driver = new ChromeDriver();
driver.get("https://google.ca");
driver.manage().window().maximize();
driver.getTitle();
}
}
For me, updating the chromedriver and selenium version removed this message.
However, this is not an actual error and just an informational message.
If your program is still passing with exit code 0 at the end even when this message is printed, it means the execution went fine.
I was able to resolve the problem by following steps:
a. upgrade to the latest chrome version, clear the cache and close the chrome browser
b. Download latest Selenium 3.0
C#:
ChromeOptions options = new ChromeOptions();
options.AddArgument("C:/Users/username/Documents/Visual Studio 2012/Projects/Interaris.Test/Interaris.Tes/bin/Debug/chromedriver.exe");
ChromeDriver chrome = new ChromeDriver(options);
Worked for me.
Sorry for late post but still for info,I also facing same problem so I Used updated version of chromedriver ie.2.28 for updated chrome browser ie. 55 to 57 which resolved my problem.
I was also getting the same issue. I resolved this issue by updating the chromedriver. So if anyone is facing same issue with chrome browser just update your chromedriver.
I saw this error
Only local connections are allowed
And I updated both the selenium webdriver, and the google-chrome-stable package
webdriver-manager update
zypper install google-chrome-stable
This site reports the latest version of the chrome driver
https://sites.google.com/a/chromium.org/chromedriver/
My working versions are chromedriver 2.41 and google-chrome-stable 68