Class: Selenium::DevTools::V131::Target
- Inherits:
-
Object
- Object
- Selenium::DevTools::V131::Target
- Defined in:
- lib/selenium/devtools/v131/target.rb
Constant Summary collapse
- EVENTS =
{ attached_to_target: 'attachedToTarget', detached_from_target: 'detachedFromTarget', received_message_from_target: 'receivedMessageFromTarget', target_created: 'targetCreated', target_destroyed: 'targetDestroyed', target_crashed: 'targetCrashed', target_info_changed: 'targetInfoChanged', }.freeze
Instance Method Summary collapse
- #activate_target(target_id:) ⇒ Object
- #attach_to_browser_target ⇒ Object
- #attach_to_target(target_id:, flatten: nil) ⇒ Object
- #auto_attach_related(target_id:, wait_for_debugger_on_start:, filter: nil) ⇒ Object
- #close_target(target_id:) ⇒ Object
- #create_browser_context(dispose_on_detach: nil, proxy_server: nil, proxy_bypass_list: nil, origins_with_universal_network_access: nil) ⇒ Object
- #create_target(url:, width: nil, height: nil, browser_context_id: nil, enable_begin_frame_control: nil, new_window: nil, background: nil, for_tab: nil) ⇒ Object
- #detach_from_target(session_id: nil, target_id: nil) ⇒ Object
- #dispose_browser_context(browser_context_id:) ⇒ Object
- #expose_dev_tools_protocol(target_id:, binding_name: nil) ⇒ Object
- #get_browser_contexts ⇒ Object
- #get_target_info(target_id: nil) ⇒ Object
- #get_targets(filter: nil) ⇒ Object
-
#initialize(devtools) ⇒ Target
constructor
A new instance of Target.
- #on(event, &block) ⇒ Object
- #send_message_to_target(message:, session_id: nil, target_id: nil) ⇒ Object
- #set_auto_attach(auto_attach:, wait_for_debugger_on_start:, flatten: nil, filter: nil) ⇒ Object
- #set_discover_targets(discover:, filter: nil) ⇒ Object
- #set_remote_locations(locations:) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ Target
Returns a new instance of Target.
35 36 37 |
# File 'lib/selenium/devtools/v131/target.rb', line 35 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#activate_target(target_id:) ⇒ Object
44 45 46 47 |
# File 'lib/selenium/devtools/v131/target.rb', line 44 def activate_target(target_id:) @devtools.send_cmd('Target.activateTarget', targetId: target_id) end |
#attach_to_browser_target ⇒ Object
55 56 57 |
# File 'lib/selenium/devtools/v131/target.rb', line 55 def attach_to_browser_target @devtools.send_cmd('Target.attachToBrowserTarget') end |
#attach_to_target(target_id:, flatten: nil) ⇒ Object
49 50 51 52 53 |
# File 'lib/selenium/devtools/v131/target.rb', line 49 def attach_to_target(target_id:, flatten: nil) @devtools.send_cmd('Target.attachToTarget', targetId: target_id, flatten: flatten) end |
#auto_attach_related(target_id:, wait_for_debugger_on_start:, filter: nil) ⇒ Object
130 131 132 133 134 135 |
# File 'lib/selenium/devtools/v131/target.rb', line 130 def (target_id:, wait_for_debugger_on_start:, filter: nil) @devtools.send_cmd('Target.autoAttachRelated', targetId: target_id, waitForDebuggerOnStart: wait_for_debugger_on_start, filter: filter) end |
#close_target(target_id:) ⇒ Object
59 60 61 62 |
# File 'lib/selenium/devtools/v131/target.rb', line 59 def close_target(target_id:) @devtools.send_cmd('Target.closeTarget', targetId: target_id) end |
#create_browser_context(dispose_on_detach: nil, proxy_server: nil, proxy_bypass_list: nil, origins_with_universal_network_access: nil) ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/selenium/devtools/v131/target.rb', line 70 def create_browser_context(dispose_on_detach: nil, proxy_server: nil, proxy_bypass_list: nil, origins_with_universal_network_access: nil) @devtools.send_cmd('Target.createBrowserContext', disposeOnDetach: dispose_on_detach, proxyServer: proxy_server, proxyBypassList: proxy_bypass_list, originsWithUniversalNetworkAccess: origins_with_universal_network_access) end |
#create_target(url:, width: nil, height: nil, browser_context_id: nil, enable_begin_frame_control: nil, new_window: nil, background: nil, for_tab: nil) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/selenium/devtools/v131/target.rb', line 82 def create_target(url:, width: nil, height: nil, browser_context_id: nil, enable_begin_frame_control: nil, new_window: nil, background: nil, for_tab: nil) @devtools.send_cmd('Target.createTarget', url: url, width: width, height: height, browserContextId: browser_context_id, enableBeginFrameControl: enable_begin_frame_control, newWindow: new_window, background: background, forTab: for_tab) end |
#detach_from_target(session_id: nil, target_id: nil) ⇒ Object
94 95 96 97 98 |
# File 'lib/selenium/devtools/v131/target.rb', line 94 def detach_from_target(session_id: nil, target_id: nil) @devtools.send_cmd('Target.detachFromTarget', sessionId: session_id, targetId: target_id) end |
#dispose_browser_context(browser_context_id:) ⇒ Object
100 101 102 103 |
# File 'lib/selenium/devtools/v131/target.rb', line 100 def dispose_browser_context(browser_context_id:) @devtools.send_cmd('Target.disposeBrowserContext', browserContextId: browser_context_id) end |
#expose_dev_tools_protocol(target_id:, binding_name: nil) ⇒ Object
64 65 66 67 68 |
# File 'lib/selenium/devtools/v131/target.rb', line 64 def expose_dev_tools_protocol(target_id:, binding_name: nil) @devtools.send_cmd('Target.exposeDevToolsProtocol', targetId: target_id, bindingName: binding_name) end |
#get_browser_contexts ⇒ Object
78 79 80 |
# File 'lib/selenium/devtools/v131/target.rb', line 78 def get_browser_contexts @devtools.send_cmd('Target.getBrowserContexts') end |
#get_target_info(target_id: nil) ⇒ Object
105 106 107 108 |
# File 'lib/selenium/devtools/v131/target.rb', line 105 def get_target_info(target_id: nil) @devtools.send_cmd('Target.getTargetInfo', targetId: target_id) end |
#get_targets(filter: nil) ⇒ Object
110 111 112 113 |
# File 'lib/selenium/devtools/v131/target.rb', line 110 def get_targets(filter: nil) @devtools.send_cmd('Target.getTargets', filter: filter) end |
#on(event, &block) ⇒ Object
39 40 41 42 |
# File 'lib/selenium/devtools/v131/target.rb', line 39 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["Target.#{event}"] << block end |
#send_message_to_target(message:, session_id: nil, target_id: nil) ⇒ Object
115 116 117 118 119 120 |
# File 'lib/selenium/devtools/v131/target.rb', line 115 def (message:, session_id: nil, target_id: nil) @devtools.send_cmd('Target.sendMessageToTarget', message: , sessionId: session_id, targetId: target_id) end |
#set_auto_attach(auto_attach:, wait_for_debugger_on_start:, flatten: nil, filter: nil) ⇒ Object
122 123 124 125 126 127 128 |
# File 'lib/selenium/devtools/v131/target.rb', line 122 def set_auto_attach(auto_attach:, wait_for_debugger_on_start:, flatten: nil, filter: nil) @devtools.send_cmd('Target.setAutoAttach', autoAttach: auto_attach, waitForDebuggerOnStart: wait_for_debugger_on_start, flatten: flatten, filter: filter) end |
#set_discover_targets(discover:, filter: nil) ⇒ Object
137 138 139 140 141 |
# File 'lib/selenium/devtools/v131/target.rb', line 137 def set_discover_targets(discover:, filter: nil) @devtools.send_cmd('Target.setDiscoverTargets', discover: discover, filter: filter) end |
#set_remote_locations(locations:) ⇒ Object
143 144 145 146 |
# File 'lib/selenium/devtools/v131/target.rb', line 143 def set_remote_locations(locations:) @devtools.send_cmd('Target.setRemoteLocations', locations: locations) end |