Class Target
java.lang.Object
org.openqa.selenium.devtools.v85.target.Target
Supports additional targets discovery and allows to attach to them.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.openqa.selenium.devtools.Command<Void>
activateTarget
(TargetID targetId) Activates (focuses) the target.static org.openqa.selenium.devtools.Event<AttachedToTarget>
static org.openqa.selenium.devtools.Command<SessionID>
Attaches to the browser target, only uses flat sessionId mode.static org.openqa.selenium.devtools.Command<SessionID>
attachToTarget
(TargetID targetId, Optional<Boolean> flatten) Attaches to the target with given id.static org.openqa.selenium.devtools.Command<Boolean>
closeTarget
(TargetID targetId) Closes the target.static org.openqa.selenium.devtools.Command<BrowserContextID>
createBrowserContext
(Optional<Boolean> disposeOnDetach, Optional<String> proxyServer, Optional<String> proxyBypassList) Creates a new empty BrowserContext.static org.openqa.selenium.devtools.Command<TargetID>
createTarget
(String url, Optional<Integer> width, Optional<Integer> height, Optional<BrowserContextID> browserContextId, Optional<Boolean> enableBeginFrameControl, Optional<Boolean> newWindow, Optional<Boolean> background) Creates a new page.static org.openqa.selenium.devtools.Event<DetachedFromTarget>
static org.openqa.selenium.devtools.Command<Void>
detachFromTarget
(Optional<SessionID> sessionId, Optional<TargetID> targetId) Detaches session with given id.static org.openqa.selenium.devtools.Command<Void>
disposeBrowserContext
(BrowserContextID browserContextId) Deletes a BrowserContext.static org.openqa.selenium.devtools.Command<Void>
exposeDevToolsProtocol
(TargetID targetId, Optional<String> bindingName) Inject object to the target's main frame that provides a communication channel with browser target.static org.openqa.selenium.devtools.Command<List<BrowserContextID>>
Returns all browser contexts created with `Target.createBrowserContext` method.static org.openqa.selenium.devtools.Command<TargetInfo>
getTargetInfo
(Optional<TargetID> targetId) Returns information about a target.static org.openqa.selenium.devtools.Command<List<TargetInfo>>
Retrieves a list of available targets.static org.openqa.selenium.devtools.Event<ReceivedMessageFromTarget>
static org.openqa.selenium.devtools.Command<Void>
Deprecated.static org.openqa.selenium.devtools.Command<Void>
setAutoAttach
(Boolean autoAttach, Boolean waitForDebuggerOnStart, Optional<Boolean> flatten) Controls whether to automatically attach to new targets which are considered to be related to this one.static org.openqa.selenium.devtools.Command<Void>
setDiscoverTargets
(Boolean discover) Controls whether to discover available targets and notify via `targetCreated/targetInfoChanged/targetDestroyed` events.static org.openqa.selenium.devtools.Command<Void>
setRemoteLocations
(List<RemoteLocation> locations) Enables target discovery for the specified locations, when `setDiscoverTargets` was set to `true`.static org.openqa.selenium.devtools.Event<TargetCrashed>
static org.openqa.selenium.devtools.Event<TargetInfo>
static org.openqa.selenium.devtools.Event<TargetID>
static org.openqa.selenium.devtools.Event<TargetInfo>
-
Constructor Details
-
Target
public Target()
-
-
Method Details
-
activateTarget
Activates (focuses) the target. -
attachToTarget
public static org.openqa.selenium.devtools.Command<SessionID> attachToTarget(TargetID targetId, Optional<Boolean> flatten) Attaches to the target with given id. -
attachToBrowserTarget
Attaches to the browser target, only uses flat sessionId mode. -
closeTarget
Closes the target. If the target is a page that gets closed too. -
exposeDevToolsProtocol
@Beta public static org.openqa.selenium.devtools.Command<Void> exposeDevToolsProtocol(TargetID targetId, Optional<String> bindingName) Inject object to the target's main frame that provides a communication channel with browser target. Injected object will be available as `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. -
createBrowserContext
@Beta public static org.openqa.selenium.devtools.Command<BrowserContextID> createBrowserContext(Optional<Boolean> disposeOnDetach, Optional<String> proxyServer, Optional<String> proxyBypassList) Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than one. -
getBrowserContexts
@Beta public static org.openqa.selenium.devtools.Command<List<BrowserContextID>> getBrowserContexts()Returns all browser contexts created with `Target.createBrowserContext` method. -
createTarget
public static org.openqa.selenium.devtools.Command<TargetID> createTarget(String url, Optional<Integer> width, Optional<Integer> height, Optional<BrowserContextID> browserContextId, Optional<Boolean> enableBeginFrameControl, Optional<Boolean> newWindow, Optional<Boolean> background) Creates a new page. -
detachFromTarget
public static org.openqa.selenium.devtools.Command<Void> detachFromTarget(Optional<SessionID> sessionId, Optional<TargetID> targetId) Detaches session with given id. -
disposeBrowserContext
@Beta public static org.openqa.selenium.devtools.Command<Void> disposeBrowserContext(BrowserContextID browserContextId) Deletes a BrowserContext. All the belonging pages will be closed without calling their beforeunload hooks. -
getTargetInfo
@Beta public static org.openqa.selenium.devtools.Command<TargetInfo> getTargetInfo(Optional<TargetID> targetId) Returns information about a target. -
getTargets
Retrieves a list of available targets. -
sendMessageToTarget
@Deprecated public static org.openqa.selenium.devtools.Command<Void> sendMessageToTarget(String message, Optional<SessionID> sessionId, Optional<TargetID> targetId) Deprecated.Sends protocol message over session with given id. Consider using flat mode instead; see commands attachToTarget, setAutoAttach, and crbug.com/991325. -
setAutoAttach
@Beta public static org.openqa.selenium.devtools.Command<Void> setAutoAttach(Boolean autoAttach, Boolean waitForDebuggerOnStart, Optional<Boolean> flatten) Controls whether to automatically attach to new targets which are considered to be related to this one. When turned on, attaches to all existing related targets as well. When turned off, automatically detaches from all currently attached targets. -
setDiscoverTargets
Controls whether to discover available targets and notify via `targetCreated/targetInfoChanged/targetDestroyed` events. -
setRemoteLocations
@Beta public static org.openqa.selenium.devtools.Command<Void> setRemoteLocations(List<RemoteLocation> locations) Enables target discovery for the specified locations, when `setDiscoverTargets` was set to `true`. -
attachedToTarget
-
detachedFromTarget
-
receivedMessageFromTarget
public static org.openqa.selenium.devtools.Event<ReceivedMessageFromTarget> receivedMessageFromTarget() -
targetCreated
-
targetDestroyed
-
targetCrashed
-
targetInfoChanged
-