Module: Playwright
- Defined in:
- lib/playwright.rb,
lib/playwright.rb,
lib/playwright/errors.rb,
lib/playwright/events.rb,
lib/playwright/channel.rb,
lib/playwright/version.rb,
lib/playwright_api/page.rb,
lib/playwright/transport.rb,
lib/playwright_api/frame.rb,
lib/playwright_api/mouse.rb,
lib/playwright_api/route.rb,
lib/playwright_api/video.rb,
lib/playwright/connection.rb,
lib/playwright_api/dialog.rb,
lib/playwright_api/worker.rb,
lib/playwright_api/browser.rb,
lib/playwright_api/request.rb,
lib/playwright_api/download.rb,
lib/playwright_api/keyboard.rb,
lib/playwright_api/response.rb,
lib/playwright/channel_owner.rb,
lib/playwright/event_emitter.rb,
lib/playwright_api/js_handle.rb,
lib/playwright_api/selectors.rb,
lib/playwright/playwright_api.rb,
lib/playwright_api/playwright.rb,
lib/playwright_api/web_socket.rb,
lib/playwright_api/cdp_session.rb,
lib/playwright_api/touchscreen.rb,
lib/playwright_api/binding_call.rb,
lib/playwright_api/browser_type.rb,
lib/playwright_api/file_chooser.rb,
lib/playwright_api/accessibility.rb,
lib/playwright_api/element_handle.rb,
lib/playwright/channel_owners/page.rb,
lib/playwright_api/browser_context.rb,
lib/playwright_api/console_message.rb,
lib/playwright/channel_owners/frame.rb,
lib/playwright/channel_owners/android.rb,
lib/playwright/channel_owners/browser.rb,
lib/playwright/channel_owners/request.rb,
lib/playwright/channel_owners/electron.rb,
lib/playwright/channel_owners/response.rb,
lib/playwright/channel_owners/js_handle.rb,
lib/playwright/channel_owners/selectors.rb,
lib/playwright/channel_owners/playwright.rb,
lib/playwright/channel_owners/binding_call.rb,
lib/playwright/channel_owners/browser_type.rb,
lib/playwright_api/chromium_browser_context.rb,
lib/playwright/channel_owners/element_handle.rb,
lib/playwright/channel_owners/webkit_browser.rb,
lib/playwright/channel_owners/browser_context.rb,
lib/playwright/channel_owners/console_message.rb,
lib/playwright/channel_owners/firefox_browser.rb,
lib/playwright/channel_owners/chromium_browser.rb,
lib/playwright/channel_owners/chromium_browser_context.rb
Overview
namespace declaration
Defined Under Namespace
Modules: ChannelOwners, EventEmitter, Events Classes: Accessibility, BindingCall, Browser, BrowserContext, BrowserType, CDPSession, Channel, ChannelOwner, ChromiumBrowserContext, Connection, ConsoleMessage, Dialog, Download, ElementHandle, Error, EventEmitterCallback, EventEmitterOnceCallback, FileChooser, Frame, JSHandle, Keyboard, Mouse, Page, Playwright, PlaywrightApi, Request, Response, RootChannelOwner, Route, Selectors, TimeoutError, Touchscreen, Transport, Video, WebSocket, Worker
Constant Summary collapse
- VERSION =
'0.0.4'
Class Method Summary collapse
- .create(playwright_cli_executable_path:, &block) ⇒ Object
- .define_channel_owner(class_name, &block) ⇒ Object
Class Method Details
.create(playwright_cli_executable_path:, &block) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/playwright.rb', line 25 module_function def create(playwright_cli_executable_path:, &block) raise ArgumentError.new("block must be provided") unless block connection = Connection.new(playwright_cli_executable_path: playwright_cli_executable_path) playwright_promise = connection.async_wait_for_object_with_known_name('Playwright') Thread.new { connection.run } playwright = PlaywrightApi.from_channel_owner(playwright_promise.value!) begin block.call(playwright) ensure connection.stop end end |
.define_channel_owner(class_name, &block) ⇒ Object
72 73 74 75 76 |
# File 'lib/playwright/channel_owner.rb', line 72 def self.define_channel_owner(class_name, &block) klass = Class.new(ChannelOwner) klass.class_eval(&block) if block ChannelOwners.const_set(class_name, klass) end |