public interface Target
| Modifier and Type | Method | Description |
|---|---|---|
void |
activateTarget(String targetId) |
Activates (focuses) the target.
|
String |
attachToTarget(String targetId) |
Attaches to the target with given id.
|
String |
attachToTarget(String targetId,
Boolean flatten) |
Attaches to the target with given id.
|
Boolean |
closeTarget(String targetId) |
Closes the target.
|
String |
createBrowserContext() |
Creates a new empty BrowserContext.
|
String |
createTarget(String url) |
Creates a new page.
|
String |
createTarget(String url,
Integer width,
Integer height,
String browserContextId,
Boolean enableBeginFrameControl) |
Creates a new page.
|
void |
detachFromTarget() |
Detaches session with given id.
|
void |
detachFromTarget(String sessionId,
String targetId) |
Detaches session with given id.
|
void |
disposeBrowserContext(String browserContextId) |
Deletes a BrowserContext.
|
void |
exposeDevToolsProtocol(String targetId) |
Inject object to the target's main frame that provides a communication
channel with browser target.
|
void |
exposeDevToolsProtocol(String targetId,
String bindingName) |
Inject object to the target's main frame that provides a communication
channel with browser target.
|
List<String> |
getBrowserContexts() |
Returns all browser contexts created with
Target.createBrowserContext method. |
TargetInfo |
getTargetInfo() |
Returns information about a target.
|
TargetInfo |
getTargetInfo(String targetId) |
Returns information about a target.
|
List<TargetInfo> |
getTargets() |
Retrieves a list of available targets.
|
void |
sendMessageToTarget(String message) |
Sends protocol message over session with given id.
|
void |
sendMessageToTarget(String message,
String sessionId,
String targetId) |
Sends protocol message over session with given id.
|
void |
setAutoAttach(Boolean autoAttach,
Boolean waitForDebuggerOnStart) |
Controls whether to automatically attach to new targets which are considered to be related to
this one.
|
void |
setDiscoverTargets(Boolean discover) |
Controls whether to discover available targets and notify via
targetCreated/targetInfoChanged/targetDestroyed events. |
void |
setRemoteLocations(List<RemoteLocation> locations) |
Enables target discovery for the specified locations, when
setDiscoverTargets was set to
true. |
void activateTarget(String targetId)
String attachToTarget(String targetId, Boolean flatten)
flatten - Enables "flat" access to the session via specifying sessionId attribute in the commands.Boolean closeTarget(String targetId)
void exposeDevToolsProtocol(String targetId, String bindingName)
window[bindingName].
The object has the follwing API:
- binding.send(json) - a method to send messages over the remote debugging protocol
- binding.onmessage = json => handleMessage(json) - a callback that will be called for the protocol notifications and command responses.bindingName - Binding name, 'cdp' if not specified.String createBrowserContext()
List<String> getBrowserContexts()
Target.createBrowserContext method.String createTarget(String url, Integer width, Integer height, String browserContextId, Boolean enableBeginFrameControl)
url - The initial URL the page will be navigated to.width - Frame width in DIP (headless chrome only).height - Frame height in DIP (headless chrome only).browserContextId - The browser context to create the page in.enableBeginFrameControl - Whether BeginFrames for this target will be controlled via DevTools (headless chrome only,
not supported on MacOS yet, false by default).void detachFromTarget(String sessionId, String targetId)
sessionId - Session to detach.targetId - Deprecated.void disposeBrowserContext(String browserContextId)
TargetInfo getTargetInfo(String targetId)
List<TargetInfo> getTargets()
void sendMessageToTarget(String message, String sessionId, String targetId)
sessionId - Identifier of the session.targetId - Deprecated.void setAutoAttach(Boolean autoAttach, Boolean waitForDebuggerOnStart)
autoAttach - Whether to auto-attach to related targets.waitForDebuggerOnStart - Whether to pause new targets when attaching to them. Use Runtime.runIfWaitingForDebugger
to run paused targets.void setDiscoverTargets(Boolean discover)
targetCreated/targetInfoChanged/targetDestroyed events.discover - Whether to discover available targets.void setRemoteLocations(List<RemoteLocation> locations)
setDiscoverTargets was set to
true.locations - List of remote locations.String attachToTarget(String targetId)
void exposeDevToolsProtocol(String targetId)
window[bindingName].
The object has the follwing API:
- binding.send(json) - a method to send messages over the remote debugging protocol
- binding.onmessage = json => handleMessage(json) - a callback that will be called for the protocol notifications and command responses.String createTarget(String url)
url - The initial URL the page will be navigated to.void detachFromTarget()
TargetInfo getTargetInfo()
void sendMessageToTarget(String message)
Copyright © 2017, 2018–2018 WebFolder OÜ. All rights reserved.