Class: Capybara::Playwright::BrowserRunner
- Inherits:
-
Object
- Object
- Capybara::Playwright::BrowserRunner
- Defined in:
- lib/capybara/playwright/browser_runner.rb
Overview
playwright-ruby-client provides 3 methods to launch/connect browser.
Playwright.create do |playwright|
playwright.chromium.launch do |browser|
Playwright.connect_to_playwright_server do |playwright| …
playwright.chromium.launch do |browser|
Playwright.connect_to_browser_server do |browser| …
This class provides start/stop methods for driver. This is responsible for
-
managing PlaywrightExecution
-
launching browser with given option if needed
Defined Under Namespace
Classes: PlaywrightConnectToBrowserServer, PlaywrightConnectToPlaywrightServer, PlaywrightCreate
Instance Method Summary collapse
-
#initialize(options) ⇒ BrowserRunner
constructor
A new instance of BrowserRunner.
- #start ⇒ ::Playwright::Browser
- #stop ⇒ Object
Constructor Details
#initialize(options) ⇒ BrowserRunner
Returns a new instance of BrowserRunner.
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/capybara/playwright/browser_runner.rb', line 76 def initialize() @runner = if [:playwright_server_endpoint_url] PlaywrightConnectToPlaywrightServer.new([:playwright_server_endpoint_url], ) elsif [:browser_server_endpoint_url] PlaywrightConnectToBrowserServer.new([:browser_server_endpoint_url]) else PlaywrightCreate.new() end end |
Instance Method Details
#start ⇒ ::Playwright::Browser
88 89 90 91 |
# File 'lib/capybara/playwright/browser_runner.rb', line 88 def start @playwright_execution = @runner.playwright_execution @runner.playwright_browser end |
#stop ⇒ Object
93 94 95 96 |
# File 'lib/capybara/playwright/browser_runner.rb', line 93 def stop @playwright_execution&.stop @playwright_execution = nil end |