Module: Playwright
- Defined in:
- lib/playwright.rb,
lib/playwright.rb,
lib/playwright/utils.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/javascript.rb,
lib/playwright/mouse_impl.rb,
lib/playwright_api/dialog.rb,
lib/playwright_api/worker.rb,
lib/playwright/input_files.rb,
lib/playwright/url_matcher.rb,
lib/playwright/wait_helper.rb,
lib/playwright_api/android.rb,
lib/playwright_api/browser.rb,
lib/playwright_api/request.rb,
lib/playwright/http_headers.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/keyboard_impl.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/timeout_settings.rb,
lib/playwright/touchscreen_impl.rb,
lib/playwright_api/binding_call.rb,
lib/playwright_api/browser_type.rb,
lib/playwright_api/file_chooser.rb,
lib/playwright/file_chooser_impl.rb,
lib/playwright_api/accessibility.rb,
lib/playwright_api/android_input.rb,
lib/playwright/android_input_impl.rb,
lib/playwright/api_implementation.rb,
lib/playwright_api/android_device.rb,
lib/playwright_api/android_socket.rb,
lib/playwright_api/element_handle.rb,
lib/playwright/channel_owners/page.rb,
lib/playwright/event_emitter_proxy.rb,
lib/playwright/javascript/function.rb,
lib/playwright/route_handler_entry.rb,
lib/playwright_api/browser_context.rb,
lib/playwright_api/console_message.rb,
lib/playwright/channel_owners/frame.rb,
lib/playwright/channel_owners/route.rb,
lib/playwright/select_option_values.rb,
lib/playwright_api/android_web_view.rb,
lib/playwright/channel_owners/dialog.rb,
lib/playwright/javascript/expression.rb,
lib/playwright/channel_owners/android.rb,
lib/playwright/channel_owners/browser.rb,
lib/playwright/channel_owners/request.rb,
lib/playwright/channel_owners/download.rb,
lib/playwright/channel_owners/electron.rb,
lib/playwright/channel_owners/response.rb,
lib/playwright/javascript/value_parser.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/javascript/value_serializer.rb,
lib/playwright_api/chromium_browser_context.rb,
lib/playwright/channel_owners/android_device.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
Defined Under Namespace
Modules: ApiImplementation, ChannelOwners, EventEmitter, EventListenerInterface, Events, JavaScript, Utils
Classes: Accessibility, Android, AndroidDevice, AndroidInput, AndroidSocket, AndroidWebView, BindingCall, Browser, BrowserContext, BrowserType, CDPSession, Channel, ChannelOwner, ChromiumBrowserContext, Connection, ConsoleMessage, Dialog, Download, ElementHandle, Error, EventEmitterCallback, EventEmitterOnceCallback, EventEmitterProxy, FileChooser, Frame, HttpHeaders, InputFiles, JSHandle, Keyboard, Mouse, Page, Playwright, PlaywrightApi, Request, Response, RootChannelOwner, Route, RouteHandlerEntry, SelectOptionValues, Selectors, TimeoutError, TimeoutSettings, Touchscreen, Transport, UrlMatcher, Video, WaitHelper, WebSocket, Worker
Constant Summary
collapse
- VERSION =
'0.3.0'
Class Method Summary
collapse
Class Method Details
.create(playwright_cli_executable_path:, &block) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/playwright.rb', line 36
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.wrap(playwright_promise.value!)
begin
block.call(playwright)
ensure
connection.stop
end
end
|
.define_api_implementation(class_name, &block) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/playwright/api_implementation.rb', line 6
def self.define_api_implementation(class_name, &block)
klass = Class.new
klass.include(ApiImplementation)
klass.class_eval(&block) if block
if ::Playwright.const_defined?(class_name)
raise ArgumentError.new("Playwright::#{class_name} already exist. Choose another class name.")
end
::Playwright.const_set(class_name, klass)
end
|
.define_channel_owner(class_name, &block) ⇒ Object
84
85
86
87
88
|
# File 'lib/playwright/channel_owner.rb', line 84
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
|