java.lang.Object
org.openqa.selenium.devtools.v85.target.Target

public class Target extends Object
Supports additional targets discovery and allows to attach to them.
  • Constructor Details

    • Target

      public Target()
  • Method Details

    • activateTarget

      public static org.openqa.selenium.devtools.Command<Void> activateTarget(TargetID targetId)
      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

      @Beta public static org.openqa.selenium.devtools.Command<SessionID> attachToBrowserTarget()
      Attaches to the browser target, only uses flat sessionId mode.
    • closeTarget

      public static org.openqa.selenium.devtools.Command<Boolean> closeTarget(TargetID targetId)
      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

      public static org.openqa.selenium.devtools.Command<List<TargetInfo>> 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

      public static org.openqa.selenium.devtools.Command<Void> setDiscoverTargets(Boolean discover)
      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

      public static org.openqa.selenium.devtools.Event<AttachedToTarget> attachedToTarget()
    • detachedFromTarget

      public static org.openqa.selenium.devtools.Event<DetachedFromTarget> detachedFromTarget()
    • receivedMessageFromTarget

      public static org.openqa.selenium.devtools.Event<ReceivedMessageFromTarget> receivedMessageFromTarget()
    • targetCreated

      public static org.openqa.selenium.devtools.Event<TargetInfo> targetCreated()
    • targetDestroyed

      public static org.openqa.selenium.devtools.Event<TargetID> targetDestroyed()
    • targetCrashed

      public static org.openqa.selenium.devtools.Event<TargetCrashed> targetCrashed()
    • targetInfoChanged

      public static org.openqa.selenium.devtools.Event<TargetInfo> targetInfoChanged()