Class: Selenium::DevTools::V85::Page
- Inherits:
-
Object
- Object
- Selenium::DevTools::V85::Page
- Defined in:
- lib/selenium/devtools/v85/page.rb
Constant Summary collapse
- EVENTS =
{ dom_content_event_fired: 'domContentEventFired', file_chooser_opened: 'fileChooserOpened', frame_attached: 'frameAttached', frame_cleared_scheduled_navigation: 'frameClearedScheduledNavigation', frame_detached: 'frameDetached', frame_navigated: 'frameNavigated', frame_resized: 'frameResized', frame_requested_navigation: 'frameRequestedNavigation', frame_scheduled_navigation: 'frameScheduledNavigation', frame_started_loading: 'frameStartedLoading', frame_stopped_loading: 'frameStoppedLoading', download_will_begin: 'downloadWillBegin', download_progress: 'downloadProgress', interstitial_hidden: 'interstitialHidden', interstitial_shown: 'interstitialShown', javascript_dialog_closed: 'javascriptDialogClosed', javascript_dialog_opening: 'javascriptDialogOpening', lifecycle_event: 'lifecycleEvent', load_event_fired: 'loadEventFired', navigated_within_document: 'navigatedWithinDocument', screencast_frame: 'screencastFrame', screencast_visibility_changed: 'screencastVisibilityChanged', window_open: 'windowOpen', compilation_cache_produced: 'compilationCacheProduced', }.freeze
Instance Method Summary collapse
- #add_compilation_cache(url:, data:) ⇒ Object
- #add_script_to_evaluate_on_load(script_source:) ⇒ Object
- #add_script_to_evaluate_on_new_document(source:, world_name: nil) ⇒ Object
- #bring_to_front ⇒ Object
- #capture_screenshot(format: nil, quality: nil, clip: nil, from_surface: nil) ⇒ Object
- #capture_snapshot(format: nil) ⇒ Object
- #clear_compilation_cache ⇒ Object
- #clear_device_metrics_override ⇒ Object
- #clear_device_orientation_override ⇒ Object
- #clear_geolocation_override ⇒ Object
- #close ⇒ Object
- #crash ⇒ Object
- #create_isolated_world(frame_id:, world_name: nil, grant_univeral_access: nil) ⇒ Object
- #delete_cookie(cookie_name:, url:) ⇒ Object
- #disable ⇒ Object
- #enable ⇒ Object
- #generate_test_report(message:, group: nil) ⇒ Object
- #get_app_manifest ⇒ Object
- #get_cookies ⇒ Object
- #get_frame_tree ⇒ Object
- #get_installability_errors ⇒ Object
- #get_layout_metrics ⇒ Object
- #get_manifest_icons ⇒ Object
- #get_navigation_history ⇒ Object
- #get_resource_content(frame_id:, url:) ⇒ Object
- #get_resource_tree ⇒ Object
- #handle_javascript_dialog(accept:, prompt_text: nil) ⇒ Object
-
#initialize(devtools) ⇒ Page
constructor
A new instance of Page.
- #navigate(url:, referrer: nil, transition_type: nil, frame_id: nil, referrer_policy: nil) ⇒ Object
- #navigate_to_history_entry(entry_id:) ⇒ Object
- #on(event, &block) ⇒ Object
- #print_to_pdf(landscape: nil, display_header_footer: nil, print_background: nil, scale: nil, paper_width: nil, paper_height: nil, margin_top: nil, margin_bottom: nil, margin_left: nil, margin_right: nil, page_ranges: nil, ignore_invalid_page_ranges: nil, header_template: nil, footer_template: nil, prefer_css_page_size: nil, transfer_mode: nil) ⇒ Object
- #reload(ignore_cache: nil, script_to_evaluate_on_load: nil) ⇒ Object
- #remove_script_to_evaluate_on_load(identifier:) ⇒ Object
- #remove_script_to_evaluate_on_new_document(identifier:) ⇒ Object
- #reset_navigation_history ⇒ Object
- #screencast_frame_ack(session_id:) ⇒ Object
- #search_in_resource(frame_id:, url:, query:, case_sensitive: nil, is_regex: nil) ⇒ Object
- #set_ad_blocking_enabled(enabled:) ⇒ Object
- #set_bypass_csp(enabled:) ⇒ Object
- #set_device_metrics_override(width:, height:, device_scale_factor:, mobile:, scale: nil, screen_width: nil, screen_height: nil, position_x: nil, position_y: nil, dont_set_visible_size: nil, screen_orientation: nil, viewport: nil) ⇒ Object
- #set_device_orientation_override(alpha:, beta:, gamma:) ⇒ Object
- #set_document_content(frame_id:, html:) ⇒ Object
- #set_download_behavior(behavior:, download_path: nil) ⇒ Object
- #set_font_families(font_families:) ⇒ Object
- #set_font_sizes(font_sizes:) ⇒ Object
- #set_geolocation_override(latitude: nil, longitude: nil, accuracy: nil) ⇒ Object
- #set_intercept_file_chooser_dialog(enabled:) ⇒ Object
- #set_lifecycle_events_enabled(enabled:) ⇒ Object
- #set_produce_compilation_cache(enabled:) ⇒ Object
- #set_touch_emulation_enabled(enabled:, configuration: nil) ⇒ Object
- #set_web_lifecycle_state(state:) ⇒ Object
- #start_screencast(format: nil, quality: nil, max_width: nil, max_height: nil, every_nth_frame: nil) ⇒ Object
- #stop_loading ⇒ Object
- #stop_screencast ⇒ Object
- #wait_for_debugger ⇒ Object
Constructor Details
#initialize(devtools) ⇒ Page
Returns a new instance of Page.
52 53 54 |
# File 'lib/selenium/devtools/v85/page.rb', line 52 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#add_compilation_cache(url:, data:) ⇒ Object
342 343 344 345 346 |
# File 'lib/selenium/devtools/v85/page.rb', line 342 def add_compilation_cache(url:, data:) @devtools.send_cmd('Page.addCompilationCache', url: url, data: data) end |
#add_script_to_evaluate_on_load(script_source:) ⇒ Object
61 62 63 64 |
# File 'lib/selenium/devtools/v85/page.rb', line 61 def add_script_to_evaluate_on_load(script_source:) @devtools.send_cmd('Page.addScriptToEvaluateOnLoad', scriptSource: script_source) end |
#add_script_to_evaluate_on_new_document(source:, world_name: nil) ⇒ Object
66 67 68 69 70 |
# File 'lib/selenium/devtools/v85/page.rb', line 66 def add_script_to_evaluate_on_new_document(source:, world_name: nil) @devtools.send_cmd('Page.addScriptToEvaluateOnNewDocument', source: source, worldName: world_name) end |
#bring_to_front ⇒ Object
72 73 74 |
# File 'lib/selenium/devtools/v85/page.rb', line 72 def bring_to_front @devtools.send_cmd('Page.bringToFront') end |
#capture_screenshot(format: nil, quality: nil, clip: nil, from_surface: nil) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/selenium/devtools/v85/page.rb', line 76 def capture_screenshot(format: nil, quality: nil, clip: nil, from_surface: nil) @devtools.send_cmd('Page.captureScreenshot', format: format, quality: quality, clip: clip, fromSurface: from_surface) end |
#capture_snapshot(format: nil) ⇒ Object
84 85 86 87 |
# File 'lib/selenium/devtools/v85/page.rb', line 84 def capture_snapshot(format: nil) @devtools.send_cmd('Page.captureSnapshot', format: format) end |
#clear_compilation_cache ⇒ Object
348 349 350 |
# File 'lib/selenium/devtools/v85/page.rb', line 348 def clear_compilation_cache @devtools.send_cmd('Page.clearCompilationCache') end |
#clear_device_metrics_override ⇒ Object
89 90 91 |
# File 'lib/selenium/devtools/v85/page.rb', line 89 def clear_device_metrics_override @devtools.send_cmd('Page.clearDeviceMetricsOverride') end |
#clear_device_orientation_override ⇒ Object
93 94 95 |
# File 'lib/selenium/devtools/v85/page.rb', line 93 def clear_device_orientation_override @devtools.send_cmd('Page.clearDeviceOrientationOverride') end |
#clear_geolocation_override ⇒ Object
97 98 99 |
# File 'lib/selenium/devtools/v85/page.rb', line 97 def clear_geolocation_override @devtools.send_cmd('Page.clearGeolocationOverride') end |
#close ⇒ Object
324 325 326 |
# File 'lib/selenium/devtools/v85/page.rb', line 324 def close @devtools.send_cmd('Page.close') end |
#crash ⇒ Object
320 321 322 |
# File 'lib/selenium/devtools/v85/page.rb', line 320 def crash @devtools.send_cmd('Page.crash') end |
#create_isolated_world(frame_id:, world_name: nil, grant_univeral_access: nil) ⇒ Object
101 102 103 104 105 106 |
# File 'lib/selenium/devtools/v85/page.rb', line 101 def create_isolated_world(frame_id:, world_name: nil, grant_univeral_access: nil) @devtools.send_cmd('Page.createIsolatedWorld', frameId: frame_id, worldName: world_name, grantUniveralAccess: grant_univeral_access) end |
#delete_cookie(cookie_name:, url:) ⇒ Object
108 109 110 111 112 |
# File 'lib/selenium/devtools/v85/page.rb', line 108 def (cookie_name:, url:) @devtools.send_cmd('Page.deleteCookie', cookieName: , url: url) end |
#disable ⇒ Object
114 115 116 |
# File 'lib/selenium/devtools/v85/page.rb', line 114 def disable @devtools.send_cmd('Page.disable') end |
#enable ⇒ Object
118 119 120 |
# File 'lib/selenium/devtools/v85/page.rb', line 118 def enable @devtools.send_cmd('Page.enable') end |
#generate_test_report(message:, group: nil) ⇒ Object
352 353 354 355 356 |
# File 'lib/selenium/devtools/v85/page.rb', line 352 def generate_test_report(message:, group: nil) @devtools.send_cmd('Page.generateTestReport', message: , group: group) end |
#get_app_manifest ⇒ Object
122 123 124 |
# File 'lib/selenium/devtools/v85/page.rb', line 122 def get_app_manifest @devtools.send_cmd('Page.getAppManifest') end |
#get_cookies ⇒ Object
134 135 136 |
# File 'lib/selenium/devtools/v85/page.rb', line 134 def @devtools.send_cmd('Page.getCookies') end |
#get_frame_tree ⇒ Object
138 139 140 |
# File 'lib/selenium/devtools/v85/page.rb', line 138 def get_frame_tree @devtools.send_cmd('Page.getFrameTree') end |
#get_installability_errors ⇒ Object
126 127 128 |
# File 'lib/selenium/devtools/v85/page.rb', line 126 def get_installability_errors @devtools.send_cmd('Page.getInstallabilityErrors') end |
#get_layout_metrics ⇒ Object
142 143 144 |
# File 'lib/selenium/devtools/v85/page.rb', line 142 def get_layout_metrics @devtools.send_cmd('Page.getLayoutMetrics') end |
#get_manifest_icons ⇒ Object
130 131 132 |
# File 'lib/selenium/devtools/v85/page.rb', line 130 def get_manifest_icons @devtools.send_cmd('Page.getManifestIcons') end |
#get_navigation_history ⇒ Object
146 147 148 |
# File 'lib/selenium/devtools/v85/page.rb', line 146 def @devtools.send_cmd('Page.getNavigationHistory') end |
#get_resource_content(frame_id:, url:) ⇒ Object
154 155 156 157 158 |
# File 'lib/selenium/devtools/v85/page.rb', line 154 def get_resource_content(frame_id:, url:) @devtools.send_cmd('Page.getResourceContent', frameId: frame_id, url: url) end |
#get_resource_tree ⇒ Object
160 161 162 |
# File 'lib/selenium/devtools/v85/page.rb', line 160 def get_resource_tree @devtools.send_cmd('Page.getResourceTree') end |
#handle_javascript_dialog(accept:, prompt_text: nil) ⇒ Object
164 165 166 167 168 |
# File 'lib/selenium/devtools/v85/page.rb', line 164 def handle_javascript_dialog(accept:, prompt_text: nil) @devtools.send_cmd('Page.handleJavaScriptDialog', accept: accept, promptText: prompt_text) end |
#navigate(url:, referrer: nil, transition_type: nil, frame_id: nil, referrer_policy: nil) ⇒ Object
170 171 172 173 174 175 176 177 |
# File 'lib/selenium/devtools/v85/page.rb', line 170 def navigate(url:, referrer: nil, transition_type: nil, frame_id: nil, referrer_policy: nil) @devtools.send_cmd('Page.navigate', url: url, referrer: referrer, transitionType: transition_type, frameId: frame_id, referrerPolicy: referrer_policy) end |
#navigate_to_history_entry(entry_id:) ⇒ Object
179 180 181 182 |
# File 'lib/selenium/devtools/v85/page.rb', line 179 def navigate_to_history_entry(entry_id:) @devtools.send_cmd('Page.navigateToHistoryEntry', entryId: entry_id) end |
#on(event, &block) ⇒ Object
56 57 58 59 |
# File 'lib/selenium/devtools/v85/page.rb', line 56 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["Page.#{event}"] << block end |
#print_to_pdf(landscape: nil, display_header_footer: nil, print_background: nil, scale: nil, paper_width: nil, paper_height: nil, margin_top: nil, margin_bottom: nil, margin_left: nil, margin_right: nil, page_ranges: nil, ignore_invalid_page_ranges: nil, header_template: nil, footer_template: nil, prefer_css_page_size: nil, transfer_mode: nil) ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/selenium/devtools/v85/page.rb', line 184 def print_to_pdf(landscape: nil, display_header_footer: nil, print_background: nil, scale: nil, paper_width: nil, paper_height: nil, margin_top: nil, margin_bottom: nil, margin_left: nil, margin_right: nil, page_ranges: nil, ignore_invalid_page_ranges: nil, header_template: nil, footer_template: nil, prefer_css_page_size: nil, transfer_mode: nil) @devtools.send_cmd('Page.printToPDF', landscape: landscape, displayHeaderFooter: , printBackground: print_background, scale: scale, paperWidth: paper_width, paperHeight: paper_height, marginTop: margin_top, marginBottom: margin_bottom, marginLeft: margin_left, marginRight: margin_right, pageRanges: page_ranges, ignoreInvalidPageRanges: ignore_invalid_page_ranges, headerTemplate: header_template, footerTemplate: , preferCSSPageSize: prefer_css_page_size, transferMode: transfer_mode) end |
#reload(ignore_cache: nil, script_to_evaluate_on_load: nil) ⇒ Object
204 205 206 207 208 |
# File 'lib/selenium/devtools/v85/page.rb', line 204 def reload(ignore_cache: nil, script_to_evaluate_on_load: nil) @devtools.send_cmd('Page.reload', ignoreCache: ignore_cache, scriptToEvaluateOnLoad: script_to_evaluate_on_load) end |
#remove_script_to_evaluate_on_load(identifier:) ⇒ Object
210 211 212 213 |
# File 'lib/selenium/devtools/v85/page.rb', line 210 def remove_script_to_evaluate_on_load(identifier:) @devtools.send_cmd('Page.removeScriptToEvaluateOnLoad', identifier: identifier) end |
#remove_script_to_evaluate_on_new_document(identifier:) ⇒ Object
215 216 217 218 |
# File 'lib/selenium/devtools/v85/page.rb', line 215 def remove_script_to_evaluate_on_new_document(identifier:) @devtools.send_cmd('Page.removeScriptToEvaluateOnNewDocument', identifier: identifier) end |
#reset_navigation_history ⇒ Object
150 151 152 |
# File 'lib/selenium/devtools/v85/page.rb', line 150 def @devtools.send_cmd('Page.resetNavigationHistory') end |
#screencast_frame_ack(session_id:) ⇒ Object
220 221 222 223 |
# File 'lib/selenium/devtools/v85/page.rb', line 220 def screencast_frame_ack(session_id:) @devtools.send_cmd('Page.screencastFrameAck', sessionId: session_id) end |
#search_in_resource(frame_id:, url:, query:, case_sensitive: nil, is_regex: nil) ⇒ Object
225 226 227 228 229 230 231 232 |
# File 'lib/selenium/devtools/v85/page.rb', line 225 def search_in_resource(frame_id:, url:, query:, case_sensitive: nil, is_regex: nil) @devtools.send_cmd('Page.searchInResource', frameId: frame_id, url: url, query: query, caseSensitive: case_sensitive, isRegex: is_regex) end |
#set_ad_blocking_enabled(enabled:) ⇒ Object
234 235 236 237 |
# File 'lib/selenium/devtools/v85/page.rb', line 234 def set_ad_blocking_enabled(enabled:) @devtools.send_cmd('Page.setAdBlockingEnabled', enabled: enabled) end |
#set_bypass_csp(enabled:) ⇒ Object
239 240 241 242 |
# File 'lib/selenium/devtools/v85/page.rb', line 239 def set_bypass_csp(enabled:) @devtools.send_cmd('Page.setBypassCSP', enabled: enabled) end |
#set_device_metrics_override(width:, height:, device_scale_factor:, mobile:, scale: nil, screen_width: nil, screen_height: nil, position_x: nil, position_y: nil, dont_set_visible_size: nil, screen_orientation: nil, viewport: nil) ⇒ Object
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/selenium/devtools/v85/page.rb', line 244 def set_device_metrics_override(width:, height:, device_scale_factor:, mobile:, scale: nil, screen_width: nil, screen_height: nil, position_x: nil, position_y: nil, dont_set_visible_size: nil, screen_orientation: nil, viewport: nil) @devtools.send_cmd('Page.setDeviceMetricsOverride', width: width, height: height, deviceScaleFactor: device_scale_factor, mobile: mobile, scale: scale, screenWidth: screen_width, screenHeight: screen_height, positionX: position_x, positionY: position_y, dontSetVisibleSize: dont_set_visible_size, screenOrientation: screen_orientation, viewport: ) end |
#set_device_orientation_override(alpha:, beta:, gamma:) ⇒ Object
260 261 262 263 264 265 |
# File 'lib/selenium/devtools/v85/page.rb', line 260 def set_device_orientation_override(alpha:, beta:, gamma:) @devtools.send_cmd('Page.setDeviceOrientationOverride', alpha: alpha, beta: beta, gamma: gamma) end |
#set_document_content(frame_id:, html:) ⇒ Object
277 278 279 280 281 |
# File 'lib/selenium/devtools/v85/page.rb', line 277 def set_document_content(frame_id:, html:) @devtools.send_cmd('Page.setDocumentContent', frameId: frame_id, html: html) end |
#set_download_behavior(behavior:, download_path: nil) ⇒ Object
283 284 285 286 287 |
# File 'lib/selenium/devtools/v85/page.rb', line 283 def set_download_behavior(behavior:, download_path: nil) @devtools.send_cmd('Page.setDownloadBehavior', behavior: behavior, downloadPath: download_path) end |
#set_font_families(font_families:) ⇒ Object
267 268 269 270 |
# File 'lib/selenium/devtools/v85/page.rb', line 267 def set_font_families(font_families:) @devtools.send_cmd('Page.setFontFamilies', fontFamilies: font_families) end |
#set_font_sizes(font_sizes:) ⇒ Object
272 273 274 275 |
# File 'lib/selenium/devtools/v85/page.rb', line 272 def set_font_sizes(font_sizes:) @devtools.send_cmd('Page.setFontSizes', fontSizes: font_sizes) end |
#set_geolocation_override(latitude: nil, longitude: nil, accuracy: nil) ⇒ Object
289 290 291 292 293 294 |
# File 'lib/selenium/devtools/v85/page.rb', line 289 def set_geolocation_override(latitude: nil, longitude: nil, accuracy: nil) @devtools.send_cmd('Page.setGeolocationOverride', latitude: latitude, longitude: longitude, accuracy: accuracy) end |
#set_intercept_file_chooser_dialog(enabled:) ⇒ Object
362 363 364 365 |
# File 'lib/selenium/devtools/v85/page.rb', line 362 def set_intercept_file_chooser_dialog(enabled:) @devtools.send_cmd('Page.setInterceptFileChooserDialog', enabled: enabled) end |
#set_lifecycle_events_enabled(enabled:) ⇒ Object
296 297 298 299 |
# File 'lib/selenium/devtools/v85/page.rb', line 296 def set_lifecycle_events_enabled(enabled:) @devtools.send_cmd('Page.setLifecycleEventsEnabled', enabled: enabled) end |
#set_produce_compilation_cache(enabled:) ⇒ Object
337 338 339 340 |
# File 'lib/selenium/devtools/v85/page.rb', line 337 def set_produce_compilation_cache(enabled:) @devtools.send_cmd('Page.setProduceCompilationCache', enabled: enabled) end |
#set_touch_emulation_enabled(enabled:, configuration: nil) ⇒ Object
301 302 303 304 305 |
# File 'lib/selenium/devtools/v85/page.rb', line 301 def set_touch_emulation_enabled(enabled:, configuration: nil) @devtools.send_cmd('Page.setTouchEmulationEnabled', enabled: enabled, configuration: configuration) end |
#set_web_lifecycle_state(state:) ⇒ Object
328 329 330 331 |
# File 'lib/selenium/devtools/v85/page.rb', line 328 def set_web_lifecycle_state(state:) @devtools.send_cmd('Page.setWebLifecycleState', state: state) end |
#start_screencast(format: nil, quality: nil, max_width: nil, max_height: nil, every_nth_frame: nil) ⇒ Object
307 308 309 310 311 312 313 314 |
# File 'lib/selenium/devtools/v85/page.rb', line 307 def start_screencast(format: nil, quality: nil, max_width: nil, max_height: nil, every_nth_frame: nil) @devtools.send_cmd('Page.startScreencast', format: format, quality: quality, maxWidth: max_width, maxHeight: max_height, everyNthFrame: every_nth_frame) end |
#stop_loading ⇒ Object
316 317 318 |
# File 'lib/selenium/devtools/v85/page.rb', line 316 def stop_loading @devtools.send_cmd('Page.stopLoading') end |
#stop_screencast ⇒ Object
333 334 335 |
# File 'lib/selenium/devtools/v85/page.rb', line 333 def stop_screencast @devtools.send_cmd('Page.stopScreencast') end |
#wait_for_debugger ⇒ Object
358 359 360 |
# File 'lib/selenium/devtools/v85/page.rb', line 358 def wait_for_debugger @devtools.send_cmd('Page.waitForDebugger') end |