Getting unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) - linux

Running TestNG scripts through docker container with standlone-chrome image, at the container level chrome fails to start in Linux machine.
capablities also includes : --disable-dev-shm-usage",--no-sandbox,--headless.
I tried updating the chrome driver but still didn't worked.
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

StackOverflow newbie here. Sharing the version of Chrome/ChromeDriver under discussion would help. In any case, we back-leveled to Chrome 78 (+ Driver), and this problem went away. It appears this error "DevToolsActivePort file doesn't exist" was introduced in late builds.
A few gotchas:
Finding an older release may be problematic; we found them here the version that worked for us is Linux_x64_693954_chrome-linux.zip
The chrome-wrapper script should be renamed to google-chrome
The chrome_sandbox executable must be renamed chrome-sandbox and chmodded 4755
Install the matching Chromedriver version 78 (chromedriver_78.0.3904.105)

Related

vscode on Ubuntu is unable to open windows

I'm having issues with vscode on Ubuntu running particular Python code (that seemingly relies on porting or connecting to an external application). The same code will run fine if I execute it directly from an Ubuntu terminal with the same env on the same machine.
Here's a couple of examples.
When I try to initiate vedo.plotter.Plotter() when running from vscode, I get this error:
ERROR: In /work/standalone-x64-build/VTK-source/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 1223
vtkXOpenGLRenderWindow (0x5587f7b42cf0): bad X server connection. DISPLAY=Aborted (core dumped)
If I run the same code directly in terminal, it runs fine, so this is an issue with the way vscode is configured, but I can't find any answers online. I've played with a few settings in vscode but with no success.
This seems to be an issue on all vscode installations I have running on Ubuntu (in this case 20.04). Here's the vscode info:
Version: 1.51.0
Commit: fcac248b077b55bae4ba5bab613fd6e9156c2f0c
Date: 2020-11-05T18:16:10.374Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Linux x64 5.4.0-52-generic snap
Similarly, I'm unable to open up browser windows from vscode (for example plotly fig.show() and selenium driver = webdriver.Chrome(chromedriver) won't open browser windows. I get the following error with selenium:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
Again, this works fine direct from the terminal and everything works fine if run from a Windows or Mac installed vscode, so this is specific to this Ubuntu install.
I'd really appreciate any help!
Jonny

Chrome crashes when running selenium python3 script as sudo

I have a python script where I login to a website using Selenium. Following is the snippet
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
browser = webdriver.Chrome("/path/to/chromdriver", desired_capabilities=chrome_options.to_capabilities())
WebDriverWait(browser, 10)
browser.maximize_window()
browser.get(url)
browser.find_element_by_xpath('//*[#id="mat-input-0"]').send_keys(username)
browser.find_element_by_xpath('//*[#id="mat-input-1"]').send_keys(pass)
browser.find_element_by_xpath('/html/body/app-root/app-login/mat-card/mat-card-content/form/div/button/span').click()
The script runs perfectly fine when run as python3 test.py. But when I run it as sudo python test.py it crashes with following error:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
What changes would I need to do to be able to run as sudo?
From the ChromeDriver - WebDriver for Chrome:
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, such a configuration is unsupported and highly discouraged. Please configure your environment to run Chrome as a regular user instead.
Conclusion
You need to execute your tests as a regular user
References
You can find a couple of relevant discussions in:
Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed
OpenQA.Selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally while executing tests through Selenium start on linux
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed using ChromeDriver Selenium in Jenkins on Ubuntu 18.04

AttributeError: 'LifoQueue' object has no attribute 'put' selenium webdriver

I have installed selenium and the chrome web driver and made it accessible via the path variable of my operating system (using Linux virtual machine on windows and python3). I run this simple code and get the below error. Any ideas as to what may cause this error?
Thanks in advance!
Selenium version installed:
selenium-3.141.0 urllib3-1.25.8
Chrome driver installed (latest version for chrome browser 80) :
ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987#{#882})
Chrome browser installed :
Google Chrome 80.0.3987.132
Python version :
Python 3.6.9
import selenium
from selenium import webdriver
options = webdriver.chrome.options.Options()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
chromedriver = '/usr/bin/chromedriver'
print('test0') #is being printed
driver = webdriver.Chrome('/usr/bin/chromedriver',options=options)
print('test') #not being printed
driver.get('http:google.com')
Error message when running the code : The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.
When I try to run google-chrome with (sudo google-chrome) I get this message:
[56:56:0316/235226.650275:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
I tried modifying the google-chrome file in the /usr/bin but it is read-only so the workaround I found online was to add the options '--no-sandbox' in my code above. But hasn't resolved the issue.
Resolved : had a python file named queue in working directory and had to rename it
Solution:
This error "AttributeError: 'LifoQueue' object has no attribute 'put' selenium webdriver" is caused by having in your working directory a file with the name Queue. Rename that.
For this error "The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed."
If you tried all possible solutions and still get issues then if you are using Linux virtual machine that seems to be causing the problem and I suggest to install docker desktop on windows and download a docker image with all the libraries you will be needing to run selenium apps .

Protractor 2.28 - headless Chrome 57 - linux - tests failed

I am trying to run protractor tests with jenkins, but I couldn't get it working.
The tests are started but all fails with one of the following exceptions:
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: content shell=)
(Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 4.4.0-22-generic x86_64)
or
Failed: Error while waiting for Protractor to sync with the page: "window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details"
The mentioned git issue doesn't help me.
All of them are running well local on a windows 10 machine.
The used versions local and on with jenkins are:
protractor: 5.1.1
chrome: 57.*
chromedriver: 2.28
I have found some issues that chrome should be downgraded to version 55.* but the all didn't solve my problem.
Thank you in advance
It says window.angular is undefined.
I assume it is not an angular site.
Have you tried entering
Browser.ignoreSynchronization = true
Before you get the browser.

ABORT: Aborting on channel error line :2076 in Selenium 3.0.0 beta 2

I have been using Selenium 3.0.0 beta2 with the Firefox 48.0.2 and geckodriverv10.0 for win 64.
The problem is that the browser crashes without closing.
> [Child 10232] ###!!! ABORT: Aborting on channel error.: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp,
> line 2046
And it passes the test case.
I tried with FF 46.0.9 as well still gives the same error.
According to the geckodriver issue #210, this was caused by mozilla bug 1051567 and will not be resolved in FF48. FF49 is recommended.
I was getting this error with FF48.0.2 on OS X 10.11.6 and geckodriver 0.10.0 with Selenium 3.0.0-beta3. I tested with 49.0b9 and still see the error, but only intermittently. The line number has changed from 2046 to 2052.
I got it to work by using these versions:
Firefox Setup 48.0.2 (32bit)
geckodriver-v0.15.0-win32
JavaSetup8u121 (32bit)
selenium-server-standalone-3.3.1

Resources