Class: Selenium::DevTools::V130::Browser
- Inherits:
-
Object
- Object
- Selenium::DevTools::V130::Browser
- Defined in:
- lib/selenium/devtools/v130/browser.rb
Constant Summary collapse
- EVENTS =
{ download_will_begin: 'downloadWillBegin', download_progress: 'downloadProgress', }.freeze
Instance Method Summary collapse
- #add_privacy_sandbox_enrollment_override(url:) ⇒ Object
- #cancel_download(guid:, browser_context_id: nil) ⇒ Object
- #close ⇒ Object
- #crash ⇒ Object
- #crash_gpu_process ⇒ Object
- #execute_browser_command(command_id:) ⇒ Object
- #get_browser_command_line ⇒ Object
- #get_histogram(name:, delta: nil) ⇒ Object
- #get_histograms(query: nil, delta: nil) ⇒ Object
- #get_version ⇒ Object
- #get_window_bounds(window_id:) ⇒ Object
- #get_window_for_target(target_id: nil) ⇒ Object
- #grant_permissions(permissions:, origin: nil, browser_context_id: nil) ⇒ Object
-
#initialize(devtools) ⇒ Browser
constructor
A new instance of Browser.
- #on(event, &block) ⇒ Object
- #reset_permissions(browser_context_id: nil) ⇒ Object
- #set_dock_tile(badge_label: nil, image: nil) ⇒ Object
- #set_download_behavior(behavior:, browser_context_id: nil, download_path: nil, events_enabled: nil) ⇒ Object
- #set_permission(permission:, setting:, origin: nil, browser_context_id: nil) ⇒ Object
- #set_window_bounds(window_id:, bounds:) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ Browser
Returns a new instance of Browser.
30 31 32 |
# File 'lib/selenium/devtools/v130/browser.rb', line 30 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#add_privacy_sandbox_enrollment_override(url:) ⇒ Object
132 133 134 135 |
# File 'lib/selenium/devtools/v130/browser.rb', line 132 def add_privacy_sandbox_enrollment_override(url:) @devtools.send_cmd('Browser.addPrivacySandboxEnrollmentOverride', url: url) end |
#cancel_download(guid:, browser_context_id: nil) ⇒ Object
67 68 69 70 71 |
# File 'lib/selenium/devtools/v130/browser.rb', line 67 def cancel_download(guid:, browser_context_id: nil) @devtools.send_cmd('Browser.cancelDownload', guid: guid, browserContextId: browser_context_id) end |
#close ⇒ Object
73 74 75 |
# File 'lib/selenium/devtools/v130/browser.rb', line 73 def close @devtools.send_cmd('Browser.close') end |
#crash ⇒ Object
77 78 79 |
# File 'lib/selenium/devtools/v130/browser.rb', line 77 def crash @devtools.send_cmd('Browser.crash') end |
#crash_gpu_process ⇒ Object
81 82 83 |
# File 'lib/selenium/devtools/v130/browser.rb', line 81 def crash_gpu_process @devtools.send_cmd('Browser.crashGpuProcess') end |
#execute_browser_command(command_id:) ⇒ Object
127 128 129 130 |
# File 'lib/selenium/devtools/v130/browser.rb', line 127 def execute_browser_command(command_id:) @devtools.send_cmd('Browser.executeBrowserCommand', commandId: command_id) end |
#get_browser_command_line ⇒ Object
89 90 91 |
# File 'lib/selenium/devtools/v130/browser.rb', line 89 def get_browser_command_line @devtools.send_cmd('Browser.getBrowserCommandLine') end |
#get_histogram(name:, delta: nil) ⇒ Object
99 100 101 102 103 |
# File 'lib/selenium/devtools/v130/browser.rb', line 99 def get_histogram(name:, delta: nil) @devtools.send_cmd('Browser.getHistogram', name: name, delta: delta) end |
#get_histograms(query: nil, delta: nil) ⇒ Object
93 94 95 96 97 |
# File 'lib/selenium/devtools/v130/browser.rb', line 93 def get_histograms(query: nil, delta: nil) @devtools.send_cmd('Browser.getHistograms', query: query, delta: delta) end |
#get_version ⇒ Object
85 86 87 |
# File 'lib/selenium/devtools/v130/browser.rb', line 85 def get_version @devtools.send_cmd('Browser.getVersion') end |
#get_window_bounds(window_id:) ⇒ Object
105 106 107 108 |
# File 'lib/selenium/devtools/v130/browser.rb', line 105 def get_window_bounds(window_id:) @devtools.send_cmd('Browser.getWindowBounds', windowId: window_id) end |
#get_window_for_target(target_id: nil) ⇒ Object
110 111 112 113 |
# File 'lib/selenium/devtools/v130/browser.rb', line 110 def get_window_for_target(target_id: nil) @devtools.send_cmd('Browser.getWindowForTarget', targetId: target_id) end |
#grant_permissions(permissions:, origin: nil, browser_context_id: nil) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/selenium/devtools/v130/browser.rb', line 47 def (permissions:, origin: nil, browser_context_id: nil) @devtools.send_cmd('Browser.grantPermissions', permissions: , origin: origin, browserContextId: browser_context_id) end |
#on(event, &block) ⇒ Object
34 35 36 37 |
# File 'lib/selenium/devtools/v130/browser.rb', line 34 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["Browser.#{event}"] << block end |
#reset_permissions(browser_context_id: nil) ⇒ Object
54 55 56 57 |
# File 'lib/selenium/devtools/v130/browser.rb', line 54 def (browser_context_id: nil) @devtools.send_cmd('Browser.resetPermissions', browserContextId: browser_context_id) end |
#set_dock_tile(badge_label: nil, image: nil) ⇒ Object
121 122 123 124 125 |
# File 'lib/selenium/devtools/v130/browser.rb', line 121 def set_dock_tile(badge_label: nil, image: nil) @devtools.send_cmd('Browser.setDockTile', badgeLabel: badge_label, image: image) end |
#set_download_behavior(behavior:, browser_context_id: nil, download_path: nil, events_enabled: nil) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/selenium/devtools/v130/browser.rb', line 59 def set_download_behavior(behavior:, browser_context_id: nil, download_path: nil, events_enabled: nil) @devtools.send_cmd('Browser.setDownloadBehavior', behavior: behavior, browserContextId: browser_context_id, downloadPath: download_path, eventsEnabled: events_enabled) end |
#set_permission(permission:, setting:, origin: nil, browser_context_id: nil) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/selenium/devtools/v130/browser.rb', line 39 def (permission:, setting:, origin: nil, browser_context_id: nil) @devtools.send_cmd('Browser.setPermission', permission: , setting: setting, origin: origin, browserContextId: browser_context_id) end |
#set_window_bounds(window_id:, bounds:) ⇒ Object
115 116 117 118 119 |
# File 'lib/selenium/devtools/v130/browser.rb', line 115 def set_window_bounds(window_id:, bounds:) @devtools.send_cmd('Browser.setWindowBounds', windowId: window_id, bounds: bounds) end |