Failure/Error: visit url
Selenium::WebDriver::Error::UnknownError:
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.)
This is my github workflow
name: CI Tests
on:
push:
branches: [ github_actions_test ]
pull_request:
branches: [ develop ]
jobs:
build:
name: CI
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Download chrome driver
uses: nanasess/setup-chromedriver@master
- name: unzip and install chrome driver
run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
- name: Setup ruby
uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
with:
ruby-version: 2.6
- name: Run bundle install
run: |
gem install bundler
bundle install
- name: Build and test with rspec
run: bundle exec rspec spec/my_spec_file.rb
My capybara config file
require 'capybara/rspec'
require 'clipboard'
require 'webdrivers/chromedriver'
require 'selenium/webdriver'
RSpec.configure do |config|
config.before :all do
register_selenium
end
config.include Capybara::DSL
end
def chrome_capabilities(chrome_options = [])
Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
args: chrome_options
}
)
end
def register_selenium
browser, profile, capabilities, driver_name, js_driver_name, options = [:chrome,
nil,
chrome_capabilities(%w[headless disable-gpu
disable-popup-blocking no-sandbox
disable-dev-shm-usage]),
:headless_chrome,
:headless_chrome,
Selenium::WebDriver::Chrome::Options.new]
Capybara.register_driver driver_name do |app|
http_client = Selenium::WebDriver::Remote::Http::Default.new
http_client.open_timeout = 250
http_client.read_timeout = 250
driver = Capybara::Selenium::Driver.new(
app,
http_client: http_client,
browser: browser,
profile: profile,
desired_capabilities: capabilities,
options: options
)
driver
end
Capybara.javascript_driver = js_driver_name
Capybara.default_driver = js_driver_name
end
- Is it possible to use chrome WITH head in github actions
- Please let me know if there is any issues with my chrome setup in github
- should we take chrome driver path from github action setup to config file. If yes how do we get the installed path
Tried all possible things and combinations of configurations. No luck. Any help would be greatly appreciated Thanks