The error (s) are
C:\Users\kclarke\workspace\Watir>cucumber features
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows
Starting ChromeDriver (v2.4.226107) on port 9515
[5988:6436:0216/144720:ERROR:gpu_info_collector_win.cc(146)] Could not read gaming score from assessment results.
[5988:6436:0216/144720:ERROR:chrome_views_delegate.cc(176)] NOT IMPLEMENTED
[5988:6436:0216/144720:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
[2636:7124:0216/144735:ERROR:ipc_channel_win.cc(405)] pipe error: 232
unknown error: Chrome failed to start: exited normally
(Driver info: chromedriver=2.4.226107,platform=Windows NT 6.1 SP1 x86_64) (Selenium::WebDriver::Error::UnknownError)
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/response.rb:51:in `assert_ok'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/bridge.rb:99:in `create_session'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
Chrome Driver (version v2.4.226107 ) installed in path: C:\Ruby200\bin;C:\Users\kclarke\workspace\bin
My Code looks like this :
require 'rubygems'
require 'watir-webdriver'
##browser = Watir::Browser.new :firefox
#browser = Watir::Browser.new :chrome
##browser = Watir::Browser.new :ie
#browser.goto 'http:XXXXXXXXXXXXXXXXX'
First, this has nothing to do with wrong PATH, as clearly you can see from the message, ChromeDriver can be started successfully.
Then I'd suggest upgrade your ChromeDriver first before doing anything else, as your version is way out of date. From the changelog here, version 2.4 is 5 months old and the latest is 2.9, which supports Chrome 31-34. (Version 2.4 claims to support Chrome 32, but your Chrome 32.0.1700.107 m now is the latest, which wasn't the one when ChromeDriver 2.4 was released.)
Related
I am currently using Selenium webdriver (4.1.0) with Ruby (2.6.6) and Chromedriver version is (v103).
After browser initialization, I have a login page and then a list page.
The driver passes through the Login page and stalls on the API for the List page.
This is the error
Net::ReadTimeout with #<TCPSocket:(closed)>
# /var/lib/jenkins/.gem/ruby/2.6.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/remote/http/default.rb:124:in `response_for'
# /var/lib/jenkins/.gem/ruby/2.6.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/remote/http/default.rb:77:in `request'
# /var/lib/jenkins/.gem/ruby/2.6.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
# /var/lib/jenkins/.gem/ruby/2.6.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/remote/bridge.rb:588:in `execute'
# /var/lib/jenkins/.gem/ruby/2.6.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/remote/bridge.rb:93:in `get'
# /var/lib/jenkins/.gem/ruby/2.6.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/common/navigation.rb:32:in `to'
# /var/lib/jenkins/.gem/ruby/2.6.0/gems/selenium-webdriver-4.1.0/lib/selenium/webdriver/common/driver.rb:143:in `get'
# /var/lib/jenkins/.gem/ruby/2.6.0/bundler/gems/Tarspect-c21e5368bc71/lib/tarspect/WebActions.rb:133:in `navigate_to'
I have increasing the Timeout but to no end.
Any Suggestions are highly appreciated !!
I've got a Lambda Function for headless chrome + python selenium deployed with Serverless framework that runs fine locally but crashes on lambda.
Some basic details:
(Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.14.231-180.360.amzn2.x86_64 x86_64)
Chromium Version: 89xx
selenium==3.141.0
Here is how i'm invoking it with selenium:
options = Options()
options.binary_location = '/opt/headless-chromium'
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--single-process')
options.add_argument("--remote-debugging-port=9222")
options.add_argument('--disable-dev-shm-usage')
#'/opt/chromedriver' not found
driver = webdriver.Chrome('/opt/chromedriver', chrome_options=options)
driver.get('https://www.neaminational.org.au/')
body = f"Headless Chrome Initialized, Page title: {driver.title}"
driver.close();
driver.quit();
response = {
"statusCode": 200,
"body": body
}
I'm getting the cryptic Message: unknown error: Chrome failed to start: exited abnormally
(chrome not reachable)
(The process started from chrome location /opt/headless-chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.).
Now i've tested this on my ubuntu 18 (same chromium binary, same chrome driver, same install selenium version) and it's working fine... so my issue must be with compatibility with the lambda amz linux environment.
Can anyone give me some idea on how i could troubleshoot this? Seems silly to stumble around trying different versions when they all seem compatible with eachother locally.
Any insight appreciated greatly!
I found this to be really helpful:
https://www.youtube.com/watch?v=jWqbYiHudt8
https://github.com/soumilshah1995/Selenium-on-AWS-Lambda-Python3.7
The versions are the following:
RUNTIME=python3.7
SELENIUM_VER=3.141.0
CHROME_BINARY_VER=v1.0.0-55 # based on Chromium 69.0.3497.81
CHROMEDRIVER_VER=2.43 # supports Chrome v69-71
Credits go to Soumil Nitin Shah.
Best,
Ramón
selenium code to automate on chrome browser.
chrome version: 79.0.3945.117 (same for local and server machine)
chrome driver: tried all latest & below till chrome version driver.
Execution Status - On Local machine:
Works fine in headless and gui.
Execution Status - On server Centros 7 machine.
works fine in headless.In GUI giving error:
options.addArguments("--no-sandbox"); // Bypass OS security model
options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
Error log
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
>>>>> Initializing the webdriver: CHROME on OS: linux64
Jan 11, 2020 12:27:52 PM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945#{#614}) on port 16949
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
>>>>> Initializing the webdriver: CHROME on OS: linux64
unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'qa9', ip: '', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1062.9.1.el7.x86_64', java.version: '1.8.0_232'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x564eeb93d479 <unknown>
Jan 11, 2020 12:27:52 PM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
null
2020-01-11 12:27:52 INFO BaseClass:23 - Test Completed
Analysis
1- Chrome is opening fine on server machine.
2- Using google-chrome --no-sandbox on server machine launches chrome
3- google-chrome is available at location /usr/bin/google-chrome
Hence tried all steps available at other answers and using various chrome options but still unable to run selenium on chrome gui.
options.addArguments("--no-sandbox"); // Bypass OS security model
options.setBinary("/usr/bin/google-chrome");
options.addArguments("start-maximized"); // open Browser in maximized mode
options.addArguments("disable-infobars"); // disabling infobars
options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
options.addArguments("--test-type");
options.addArguments("--window-size=1420,1080");
options.addArguments("--disable-extensions"); //to disable browser extension popup
options.addArguments("--headless");
options.addArguments("--disable-gpu"); // applicable to windows os only
options.setExperimentalOption("useAutomationExtension", false);
options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
ChromeDriver logs
[1578754796.203][INFO]: Launching chrome: /usr/bin/google-chrome --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-blink-features=ShadowDOMV0 --enable-logging --log-level=0 --no-first-run --no-sandbox --password-store=basic --remote-debugging-port=0 --start-maximized --test-type --use-mock-keychain --user-data-dir=/tmp/.com.google.Chrome.CKtLXZ --window-size=1420,1080 data:,
(google-chrome:29029): Gtk-WARNING **: 15:59:56.269: cannot open display:
[0111/155956.272402:ERROR:nacl_helper_linux.cc(311)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
[1578754796.304][INFO]: [e36d644ac30ae2e028b2ee00ba18b335] RESPONSE InitSession ERROR unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
[1578754796.304][DEBUG]: Log type 'driver' lost 0 entries on destruction
[1578754796.304][DEBUG]: Log type 'browser' lost 0 entries on destruction
This error message...
unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
You need to take care of a couple of things:
The purpose of the argument --disable-gpu was to enable google-chrome-headless on windows platform. It was needed as SwiftShader fails an assert on Windows in headless mode earlier. This issue was resolved through Headless: make --disable-gpu flag unnecessary. As you are on centos you need to remove the line of code:
options.addArguments("--disable-gpu"); // applicable to windows os only
As per your question as you are using chrome=79.0 you need to ensure:
ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
As you are adding the ExperimentalOption:
options.setExperimentalOption("useAutomationExtension", false);
You also need to add the ExperimentalOption:
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
But you need to remove:
options.addArguments("disable-infobars"); // disabling infobars
options.addArguments("--disable-extensions"); //to disable browser extension popup
Reference
You can find a relevant detailed discussion in:
Chrome Options in Python Selenium : Disable GPU vs Headless
ERROR:gpu_process_transport_factory.cc(1007)-Lost UI shared context : while initializing Chrome browser through ChromeDriver in Headless mode
An answer provided here indicts Chrome version > 78 as the cause. Once we back-leveled, problem subsided:
I had this problem. I installed the latest version of the "webdrivers" Rubygem (~> 4.2.0). Then, on my server, I ran:
whereis google-chrome
And got "/usr/bin/google-chrome"
I use ruby, and can now instantiate chrome with
options = Selenium::WebDriver::Chrome::Options.new(args: ['headless'], binary: '/usr/bin/google-chrome')
driver = Selenium::WebDriver.for(:chrome, options: options)
In [12]: from selenium import webdriver
In [13]: chrome_options = webdriver.ChromeOptions()
In [14]: chrome_options.add_argument('--no_sandbox')
In [15]: chrome_options.add_argument('--privileged')
In [16]: browser = webdriver.Chrome('/home/jeremie/Downloads/chromedriver', chrome_o
...: ptions=chrome_options)
In [17]: browser.get('http://localhost:8000')
When I ran the last line, I got
WebDriverException: Message: chrome not reachable
(Session info: chrome=58.0.3029.81)
(Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 4.8.0-32-generic x86_64)
I tried to change another version of the chromedriver, but I got other issues. I tried to fix my problem with other question from SE, but nothing solved my problem. What could I do to fix that problem?
check you have the execution right on the chrome bin. Is possbile the chrome browser installed not by your account?
Give a try not to add arguments to chromeOptions
Give a try with lower down your chromedriver version
I guess you are not setProperty()
driver = webdriver.Chrome('C:\\Users\\Downloads\\chromedriver_win32\\chromedriver.exe')
driver.get("https://stackoverflow.com/")
There can be multiple reasons for seeing the WebDriverException as chrome not reachable.
First and foremost, we have to ensure that our Selenium version, chromedriver version and Chrome version are compatible. You can find the compatibility information on the Downloads page of ChromeDriver individually for each releases.
Consider removing all the dangling chromedriver instances from you system. If possible make a system restart.
Periodically run CCleaner to wipe away all the previous execution leftovers.
When you initialized the webdriver instance, you mentioned:
browser = webdriver.Chrome('/home/jeremie/Downloads/chromedriver', chrome_options=chrome_options)
Instead, while we mention the absolute path of the chromedriver binary we must also provide the argument executable_path. So we may need to change to:
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path='/home/jeremie/Downloads/chromedriver')
driver.get("https://stackoverflow.com/")
Updated the firefox to version 48 but it give the following error. Any help how to solve it:
Selenium::WebDriver::Error::WebDriverError: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/launcher.rb:90:in connect_until_stable'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/launcher.rb:55:inblock in launch'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/socket_lock.rb:43:in locked'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/launcher.rb:51:inlaunch'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/firefox/bridge.rb:43:in initialize'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/driver.rb:53:innew'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/common/driver.rb:53:in for'
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver.rb:86:infor'
from /Library/Ruby/Gems/2.0.0/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:13:in browser'
from /Library/Ruby/Gems/2.0.0/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:45:invisit'
from /Library/Ruby/Gems/2.0.0/gems/capybara-2.6.2/lib/capybara/session.rb:232:in visit'
from /Library/Ruby/Gems/2.0.0/gems/capybara-2.6.2/lib/capybara/dsl.rb:51:inblock (2 levels) in '
from /Users/mesutgunes/scripts/capybara.rb:53
from /usr/bin/irb:12:in `'
Firefox v48 is not usable (in Capybara) without selenium-webdriver v3 and geckodriver. There is a beta version of selenium-webdriver v3 but it is currently missing a number of critical features (can't read the current value of form element for instance) and isn't really ready for real testing use yet. Downgrade to 47 for now.