Class: Capybara::Playwright::Driver

Inherits:
Driver::Base
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/capybara/playwright/driver.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, **options) ⇒ Driver

Returns a new instance of Driver.



6
7
8
9
10
11
12
13
14
15
# File 'lib/capybara/playwright/driver.rb', line 6

def initialize(app, **options)
  @playwright_cli_executable_path = options[:playwright_cli_executable_path] || 'npx playwright'
  @browser_type = options[:browser_type] || :chromium
  unless i(chromium firefox webkit).include?(@browser_type)
    raise ArgumentError.new("Unknown browser_type: #{@browser_type}")
  end

  @browser_options = BrowserOptions.new(options)
  @page_options = PageOptions.new(options)
end

Instance Method Details

#browserObject



20
21
22
# File 'lib/capybara/playwright/driver.rb', line 20

def browser
  @browser ||= create_browser
end

#invalid_element_errorsObject



57
58
59
60
61
62
# File 'lib/capybara/playwright/driver.rb', line 57

def invalid_element_errors
  @invalid_element_errors ||= [
    Node::NotActionableError,
    Node::StaleReferenceError,
  ].freeze
end

#needs_server?Boolean

Returns:

  • (Boolean)


18
# File 'lib/capybara/playwright/driver.rb', line 18

def needs_server?; true; end

#no_such_window_errorObject



64
65
66
# File 'lib/capybara/playwright/driver.rb', line 64

def no_such_window_error
  Browser::NoSuchWindowError
end

#reset!Object



52
53
54
55
# File 'lib/capybara/playwright/driver.rb', line 52

def reset!
  quit
  @browser = nil
end

#wait?Boolean

Returns:

  • (Boolean)


17
# File 'lib/capybara/playwright/driver.rb', line 17

def wait?; true; end