Class: Capybara::Playwright::Driver
- Inherits:
-
Driver::Base
- Object
- Driver::Base
- Capybara::Playwright::Driver
show all
- Extended by:
- Forwardable
- Includes:
- DriverExtension
- Defined in:
- lib/capybara/playwright/driver.rb
Instance Method Summary
collapse
#on_save_raw_screenshot_before_reset, #on_save_screenrecord, #with_playwright_page
Constructor Details
#initialize(app, **options) ⇒ Driver
Returns a new instance of Driver.
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/capybara/playwright/driver.rb', line 9
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
#browser ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/capybara/playwright/driver.rb', line 23
def browser
@browser ||= ::Capybara::Playwright::Browser.new(
driver: self,
playwright_browser: playwright_browser,
page_options: @page_options.value,
record_video: callback_on_save_screenrecord?,
)
end
|
#invalid_element_errors ⇒ Object
#needs_server? ⇒ Boolean
21
|
# File 'lib/capybara/playwright/driver.rb', line 21
def needs_server?; true; end
|
#no_such_window_error ⇒ Object
#reset! ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/capybara/playwright/driver.rb', line 64
def reset!
if callback_on_save_screenshot?
raw_screenshot = @browser&.raw_screenshot
if raw_screenshot
callback_on_save_screenshot(raw_screenshot)
end
end
video_path = @browser&.video_path
@browser&.clear_browser_contexts
if video_path
callback_on_save_screenrecord(video_path)
end
@browser = nil
end
|
#wait? ⇒ Boolean
20
|
# File 'lib/capybara/playwright/driver.rb', line 20
def wait?; true; end
|