Selenium and Chrome Compatibility (v67 + 2.38 chromedriver) - python

I am currently trying to run a python program on my linux box. I keep getting this error:
I am using Chrome version 67 and Selenium chromedriver of 2.38. Which I thought were compatible? Any ideas what I am doing wrong?
selenium.common.exceptions.SessionNotCreatedException: Message: session not created exception
from disconnected: Unable to receive message from renderer
(Session info: chrome=67.0.3396.62)
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 3.13.0-92-generic x86_64)

As per your error stack trace as you are using chromedriver=2.38 and chrome=67.0 this issue must not have arised.
Even the discussion Get a "WebDriverException: disconnected: unable to receive message from renderer" error when switching browser windows doesn't provides any proper conclusion. However you can try a couple of upgrade/cleanup steps as follows:
Upgrade Selenium to current levels Version 3.12.0.
Keep ChromeDriver to current ChromeDriver v2.38 level.
Keep Chrome version at Chrome v67.x levels. (as per ChromeDriver v2.38 release notes)
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 Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.
You will find similar discussions in:
Automation Testing Error : org.openqa.selenium.WebDriverException: disconnected: unable to connect to renderer
Error [SEVERE]: Timed out receiving message from renderer: 20.000 while executing the testsuite through Selenium on Jenkins

Related

bluetooth_adapter_winrt.cc:715 GetBluetoothAdapterStaticsActivationFactory failed [duplicate]

I have updated Selenium but the error keeps occurring even though the web page loads. However, in some instances, the driver starts but it is stagnant. Is this causing an issue and if so, how do I resolve it?
[11556:9032:0502/152954.314:ERROR:device_event_log_impl.cc(162)] [15:29:54.314] Bluetooth: bluetooth_adapter_winrt.cc:1055 Getting Default Adapter failed.
This error message...
ERROR:device_event_log_impl.cc(162)] [15:29:54.314] Bluetooth: bluetooth_adapter_winrt.cc:1055 Getting Default Adapter failed.
...implies that ScopedClosureRunner on_init failed in BluetoothAdapterWinrt::OnGetDefaultAdapter().
Analysis
This error is defined in bluetooth_adapter_winrt.cc as follows:
void BluetoothAdapterWinrt::OnGetDefaultAdapter(
base::ScopedClosureRunner on_init,
ComPtr<IBluetoothAdapter> adapter) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!adapter) {
BLUETOOTH_LOG(ERROR) << "Getting Default Adapter failed.";
return;
}
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v84.0 level.
Chrome is updated to current Chrome Version 84.0 level. (as per ChromeDriver v84.0 release notes)
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Additional considerations
However it was observed that this error can be supressed by running Chrome as root user (administrator) on Linux. but that would be a deviation from the documentation in ChromeDriver - WebDriver for Chrome where it is mentioned:
A common cause for Chrome to crash during startup is running Chrome as root user (administrator) on Linux. While it is possible to work around this issue by passing '--no-sandbox' flag when creating your WebDriver session, i.e. the ChromeDriver session as such a configuration is unsupported and highly discouraged.
Ideally, you need to configure your environment to run Chrome as a regular user instead.
Suppressing the error
Finally, as per the documentation in Selenium Chrome Driver: Resolve Error Messages Regarding Registry Keys and Experimental Options these error logs can be supressed by adding the argument:
excludeSwitches: ['enable-logging']
So your effective code block will be:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-logging"])
driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
driver.get("https://www.google.com/")
I had simmilar problems
ConnectionResetError: [WinError 10054] An existing connection was
forcibly closed by the remote host and
Bluetooth: bluetooth_adapter_winrt.cc:1055 Getting Default Adapter
failed.
Both of them disapeared after running cmd as an administrator. I don't know what is the exact cause of this issue but for me it seems that's a lack of privs while running selenium.
If anyone could explain why it is happening would be great.
Simply switching on my device's Bluetooth solved the problem... Don't know the reason behind it
I was getting the same error. On a code that was working yesterday.
The Code is available at this url at this moment https://youtu.be/0kLoVGLTISg?list=PLUDwpEzHYYLvx6SuogA7Zhb_hZl3sln66&t=4073
https://github.com/Microsoft/vscode-python/issues/3252 Found the Resolution hint over here in the comments section, along with https://docs.python.org/3/library/unittest.html#unittest.TestCase.setUp,
suggesting that, we cannot run on "Pycharm"/VSCode using right click -> run from within the class level, we need to run it from the module level i.e. outside the class level, since setUpClass() method is not executed when running from inside of the class.

Message: Unable to find a matching set of capabilities error using Selenium and GeckoDriver while loading on live server

I have to build an web application on a linux webserver that will use selenium with firefox . When I run the application the the linux server "localhost:5000" it works perfectly fine . But when i tried it with "127.0.0.1:80" it is not giving me an error during webdriver loading:
driver = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')
Error:
"Message: Unable to find a matching set of capabilities"
In nginx access.log it is producing a http 200 and there is nothing on error.log
in geckodriver.log it produce:
Listening on port 41209
Environment details:
selenium = 3.8.0
geckodriver = 0.18.0
Firefox version 53
python = 3.6
nginx imageApp.conf
server {
listen 80;
server_name 127.0.0.1;
location / {
include proxy_params;
proxy_pass http://unix:/home/administator/imageDetectionApplication/imageDetectionApplication.sock;
}
}
imageDetectionApplication.service
I am completely new in linux server...!!
This error message...
Message: Unable to find a matching set of capabilities
...implies that the GeckoDriver was unable to initiate/spawn a new Browsing Context i.e. Firefox Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Your Selenium Client version is 3.8.0 which is almost 2.5 years older.
Your JDK version is unknown to us.
Your GeckoDriver version is 0.18.0 which is older.
Your Firefox version is 53 which is also pretty old.
So there is a clear mismatch between the Selenium Client v3.8.0 , GeckoDriver v0.18.0 and the Firefox Browser v53
Solution
Ensure that:
JDK is upgraded to current levels JDK 8u251.
Selenium is upgraded to current levels Version 3.141.59.
GeckoDriver is upgraded to GeckoDriver v0.26.0 level.
Firefox is upgraded to current Firefox v72.0 levels.
GeckoDriver is present in the desired location.
GeckoDriver is having executable permission for non-root users.
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 install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your Test as a non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
References
You can find a couple of relevant discussions in:
Selenium “Unable to find a matching set of capabilities” despite driver being in /usr/local/bin
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities with Firefox 46 through Selenium
Selenium WebDriver, Firefox, Centos, unable to find a matching set of capabilities
Unable to find a matching set of capabilities with selenium 3.4.3, firefox 54.0 and gecko driver 0.17
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities with GeckoDriver, Selenium and Firefox

WebDriverError: disconnected: unable to connect to renderer(python) [duplicate]

I try to run this simple program on Java with Selenium:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class MySelenium {
public static void main(String[] args) {
System.out.println("First Selenium");
System.setProperty("webdriver.chrome.driver", "C:\\automation\\drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.seleniumhq.org/");
driver.quit();
}
}
But on running shows the following error:
How can i fixed this error ?
This error message...
org.openqa.selenium.SessionNotCreatedException: session not created
disconnected: unable to send message to renderer
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
I suspect your main issue is the incompatibility between the version of the binaries you are using.
As per the snapshot you have provided the following set of binaries you are using looks fine to me:
JDK: 1.8.0_191
Selenium: 3.14.0
ChromeDriver: 2.43
Chrome: 69.0
Analysis & Solution
As per Unable to receive message from renderer error using chrome driver 2.27 another pottential reason can be presence of antivirus within your localhost which you need to disable.
Ensure that /etc/hosts on your system contains the following entry:
127.0.0.1 localhost.localdomain localhost
#or
127.0.0.1 localhost loopback
Keep Chrome version between Chrome v68-70 levels. (as per ChromeDriver v2.43 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
(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.
Take a System Reboot.
Execute your #Test.
Reference
You can find a related discussion in Automation Testing Error : org.openqa.selenium.WebDriverException: disconnected: unable to connect to renderer
tl;dr
As per ChromeDriver 2.34 doesn't wait until iframe content loads after switching into iframe this issue was also observed with ChromeDriver 2.38 and Chrome 67+ combo and was related to static iframes (part of the originally loaded DOM) which seem to work correctly even till Chrome 66.
Try using JDK 1.8.0_181. I had the same issue after updating to JDK 1.8.0_191.

Python selenium WebDriverException: chrome not reachable while opening ChromeDriver

I am using Selenium Chrome Webdriver to open a webpage in Python 3.
I would like to have a function that can open the webpage.
I originally had:
driver = webdriver.Chrome(executable_path=r'C:\Users\alice\Desktop\chromedriver')
driver.get('https://reports.blm.gov/report/LR2000/23/Pub-MC-Geo-Index')
I put it in to a function goTo()
def goTo():
driver = webdriver.Chrome(executable_path=r'C:\Users\alice\Desktop\chromedriver')
driver.get('https://reports.blm.gov/report/LR2000/23/Pub-MC-Geo-Index')
However, I was unable to do any other action on that page outside of that goTo function. When try I get error:
WebDriverException: chrome not reachable
(Session info: chrome=65.0.3325.181)
(Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.16299 x86_64)
Does anyone knows how can I open the a page properly using a function?
The error says it all :
WebDriverException: chrome not reachable
(Session info: chrome=65.0.3325.181)
(Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.16299 x86_64)
Your main issue is the version compatibility between the binaries you are using as follows :
You are using chromedriver=2.35
Release Notes of chromedriver=2.35 clearly mentions the following :
Supports Chrome v62-64
You are using chrome=65.0
Release Notes of ChromeDriver v2.36 clearly mentions the following :
Supports Chrome v64-66
So there is a clear mismatch between the ChromeDriver version (v2.35) and the Chrome Browser version (v65.0)
Solution
Upgrade Selenium to current levels Version 3.11.0.
Upgrade ChromeDriver to current ChromeDriver v2.37 level.
Keep Chrome version at Chrome v65.x levels. (as per ChromeDriver v2.37 release notes)
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 Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Unable to run selenium application using the Chrome driver on a server

I've installed the latest version of Chrome driver which is 2.9 on a server on Ubuntu, with no display. I've setup everything else. When I run my python script, I get this:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"3104.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=54.0.2840.71)
(Driver info: chromedriver=2.9.248304,platform=Linux 4.4.0-38-generic x86_64)
How to fix this?
In general you can't run the Selenium with ordinary FF or Chrome without display.
As far as I know you have these options:
Create virtual display on your server. What you are looking for is VNC server. You can check for example this tutorial. With this you can set-up how many virtual display on your sever you want and run the actual browsers using selenium in them.
Use headless browser (which doesn't require display). I know that PhantomJS is often used. But it seems that Chrome is going to support this soon. You can find plenty of the guides on the google on this topic.

Categories