mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Improve headless chrome detection
This commit is contained in:
parent
21844c783c
commit
db779f3b0d
1 changed files with 8 additions and 1 deletions
|
@ -308,9 +308,16 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
||||||
|
|
||||||
# @api private
|
# @api private
|
||||||
def headless_chrome?
|
def headless_chrome?
|
||||||
chrome? && ((@processed_options[:desired_capabilities][:chrome_options] || {})['args'] || []).include?("headless")
|
if chrome?
|
||||||
|
caps = @processed_options[:desired_capabilities]
|
||||||
|
chrome_options = caps[:chrome_options] || caps[:chromeOptions] || {}
|
||||||
|
args = chrome_options['args'] || chrome_options[:args] || []
|
||||||
|
return args.include?("headless")
|
||||||
|
end
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# @deprecated This method is being removed
|
# @deprecated This method is being removed
|
||||||
def browser_initialized?
|
def browser_initialized?
|
||||||
super && !@browser.nil?
|
super && !@browser.nil?
|
||||||
|
|
Loading…
Add table
Reference in a new issue