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.
Related
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
I am trying to run selenium by running the below two lines of code after giving the path to chromedriver..
from selenium import webdriver
driver=webdriver.Chrome("C:/Users/Admin/Desktop/chromedriver")
But its not working and displaying the below error.
selenium.common.exceptions.WebDriverException: Message: Service C:/Users/Admin/Desktop/chromedriver unexpectedly exited. Status code was: 1
Can you please tell how to fix it ?
Check your chrome brower version and download chromedriver accordingly from below url https://sites.google.com/a/chromium.org/chromedriver/downloads
from selenium import webdriver
browser = webdriver.Chrome(executable_path=r" path of chromedriver.exe")
browser.get('your url')
i think you are missing some libraries, i had a similar problem when i was trying stuff with selenium. try installing the chromium driver as well cause it might have the libraries you need, even if you don't want to use chromium
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
I am running Selenium file on Amazon AWS Ubuntu Server, but I am getting the following error on the below line:
driver = webdriver.Chrome();
The error says:
selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127
I have tried many solutions but it is still not working (How to fix Selenium WebDriverException: The browser appears to have exited before we could connect?)
I have also tried with:
driver = webdriver.Firefox();
and in Firefox, I am getting the following error:
selenium.common.exceptions.WebDriverException: Message: connection refused
Can anyone help me?
Since its Amazon AWS please check if Chrome is installed, if not please install from link.
Do you install chromedriver or geckodriver on the server? Your chromedriver should be in all of following directory:
chromedriver: /usr/bin/chromedriver /bin/chromedriver
/usr/local/bin/chromedriver /usr/local/chromedriver
Or, you can paste path directly:
driver = webdriver.Chrome(path='./chromedriver').
Also, use PyVirtualDisplay.
Your problem is due to no display in AWS. When you are trying to execute the command driver = webdriver.Firefox() or driver = webdriver.Chrome() the system tries to launch a Firefox or Chrome browser but because you do not have access to the display in remote access so it is crashing there.
Follow the steps given at this blog and you can create a virtual display to buffer frames. Then your script will not crash due to this problem
I am experiencing a very strange behaviour when testing Chrome via selenium webdriver.
Instead of navigating to pages like one would expect the 'get' command leads only to the download of tiny files (no type or.apsx files) from the target site.
Importantly - this behavior only occurs when I pass chrome_options as an argument
to the Chrome driver.
The same testing scripts work flawless with firefox driver.
Code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options # tried with and without
proxy = '127.0.0.1:9951' # connects to a proxy application
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % proxy)
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('whatismyip.com')
Leads to the automatic download of a file called download (no file extension, Size 2 Byte).
While calling other sites results in the download of small aspx files.
This all happens while the browser page remains blank and no interaction with
elements happen = the site is not loaded at all.
No error message, except element not found is thrown.
This is really strange.
Additional info:
I run Debian Wheezy 32 bit and use Python 2.7.
Any suggestions how to solve this issue?
I tried your code and captured the traffic on localhost using an SOCKS v5 proxy through SSH. It is definitely sending data through the proxy but no data is coming back. I have confirmed the proxy was working using Firefox.
I'm running Google Chrome on Ubuntu 14.04 LTS 64-bit. My Chrome browser gives me the following message when I try to configure a proxy in its settings menu:
When running Google Chrome under a supported desktop environment, the
system proxy settings will be used. However, either your system is not
supported or there was a problem launching your system configuration.
But you can still configure via the command line. Please see man
google-chrome-stable for more information on flags and environment
variables.
Unfortunately I don't have a man page for google-chrome-stable.
I also discovered that according to the selenium documentation Chrome is using the system wide proxy settings and according to their documentation it is unknown how to set the proxy in Chrome programmatically: http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#using-a-proxy