Class: Capybara::Playwright::BrowserRunner::PlaywrightCreate
- Inherits:
-
Object
- Object
- Capybara::Playwright::BrowserRunner::PlaywrightCreate
- Defined in:
- lib/capybara/playwright/browser_runner.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ PlaywrightCreate
constructor
A new instance of PlaywrightCreate.
- #playwright_browser ⇒ Object
- #playwright_execution ⇒ Object
Constructor Details
#initialize(options) ⇒ PlaywrightCreate
Returns a new instance of PlaywrightCreate.
54 55 56 57 58 59 60 61 |
# File 'lib/capybara/playwright/browser_runner.rb', line 54 def initialize() @playwright_cli_executable_path = [:playwright_cli_executable_path] || 'npx playwright' @browser_type = [:browser_type] || :chromium unless %i(chromium firefox webkit).include?(@browser_type) raise ArgumentError.new("Unknown browser_type: #{@browser_type}") end @browser_options = BrowserOptions.new() end |
Instance Method Details
#playwright_browser ⇒ Object
69 70 71 72 73 |
# File 'lib/capybara/playwright/browser_runner.rb', line 69 def playwright_browser browser_type = playwright_execution.playwright.send(@browser_type) = @browser_options.value browser_type.launch(**) end |
#playwright_execution ⇒ Object
63 64 65 66 67 |
# File 'lib/capybara/playwright/browser_runner.rb', line 63 def playwright_execution @playwright_execution ||= ::Playwright.create( playwright_cli_executable_path: @playwright_cli_executable_path, ) end |