Class: Capybara::Playwright::BrowserRunner::PlaywrightConnectToPlaywrightServer
- Inherits:
-
Object
- Object
- Capybara::Playwright::BrowserRunner::PlaywrightConnectToPlaywrightServer
- Defined in:
- lib/capybara/playwright/browser_runner.rb
Instance Method Summary collapse
-
#initialize(endpoint_url, options) ⇒ PlaywrightConnectToPlaywrightServer
constructor
A new instance of PlaywrightConnectToPlaywrightServer.
- #playwright_browser ⇒ Object
- #playwright_execution ⇒ Object
Constructor Details
#initialize(endpoint_url, options) ⇒ PlaywrightConnectToPlaywrightServer
Returns a new instance of PlaywrightConnectToPlaywrightServer.
19 20 21 22 23 24 25 26 |
# File 'lib/capybara/playwright/browser_runner.rb', line 19 def initialize(endpoint_url, ) @ws_endpoint = endpoint_url @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
32 33 34 35 36 |
# File 'lib/capybara/playwright/browser_runner.rb', line 32 def playwright_browser browser_type = playwright_execution.playwright.send(@browser_type) = @browser_options.value browser_type.launch(**) end |
#playwright_execution ⇒ Object
28 29 30 |
# File 'lib/capybara/playwright/browser_runner.rb', line 28 def playwright_execution @playwright_execution ||= ::Playwright.connect_to_playwright_server("#{@ws_endpoint}?browser=#{@browser_type}") end |