Package com.microsoft.playwright.impl
Class CDPSessionImpl
- java.lang.Object
-
- com.microsoft.playwright.impl.LoggingSupport
-
- com.microsoft.playwright.impl.ChannelOwner
-
- com.microsoft.playwright.impl.CDPSessionImpl
-
- All Implemented Interfaces:
CDPSession
public class CDPSessionImpl extends ChannelOwner implements CDPSession
-
-
Field Summary
Fields Modifier and Type Field Description private ListenerCollection<java.lang.String>listeners-
Fields inherited from class com.microsoft.playwright.impl.ChannelOwner
connection, guid, initializer, type
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCDPSessionImpl(ChannelOwner parent, java.lang.String type, java.lang.String guid, com.google.gson.JsonObject initializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddetach()Detaches the CDPSession from the target.(package private) voidhandleEvent(java.lang.String event, com.google.gson.JsonObject parameters)voidoff(java.lang.String event, java.util.function.Consumer<com.google.gson.JsonObject> handler)Unregister an event handler for events with the specified event name.voidon(java.lang.String event, java.util.function.Consumer<com.google.gson.JsonObject> handler)Register an event handler for events with the specified event name.com.google.gson.JsonObjectsend(java.lang.String method)com.google.gson.JsonObjectsend(java.lang.String method, com.google.gson.JsonObject params)-
Methods inherited from class com.microsoft.playwright.impl.ChannelOwner
adopt, disposeChannelOwner, runUntil, sendMessage, sendMessage, sendMessageAsync, toProtocolRef, withLogging, withWaitLogging
-
Methods inherited from class com.microsoft.playwright.impl.LoggingSupport
logApi, logApiIfEnabled, logWithTimestamp, withLogging
-
-
-
-
Field Detail
-
listeners
private final ListenerCollection<java.lang.String> listeners
-
-
Constructor Detail
-
CDPSessionImpl
protected CDPSessionImpl(ChannelOwner parent, java.lang.String type, java.lang.String guid, com.google.gson.JsonObject initializer)
-
-
Method Detail
-
handleEvent
void handleEvent(java.lang.String event, com.google.gson.JsonObject parameters)- Overrides:
handleEventin classChannelOwner
-
send
public com.google.gson.JsonObject send(java.lang.String method)
- Specified by:
sendin interfaceCDPSession- Parameters:
method- Protocol method name.
-
send
public com.google.gson.JsonObject send(java.lang.String method, com.google.gson.JsonObject params)- Specified by:
sendin interfaceCDPSession- Parameters:
method- Protocol method name.params- Optional method parameters.
-
on
public void on(java.lang.String event, java.util.function.Consumer<com.google.gson.JsonObject> handler)Description copied from interface:CDPSessionRegister an event handler for events with the specified event name. The given handler will be called for every event with the given name.- Specified by:
onin interfaceCDPSession- Parameters:
event- CDP event name.handler- Event handler.
-
off
public void off(java.lang.String event, java.util.function.Consumer<com.google.gson.JsonObject> handler)Description copied from interface:CDPSessionUnregister an event handler for events with the specified event name. The given handler will not be called anymore for events with the given name.- Specified by:
offin interfaceCDPSession- Parameters:
event- CDP event name.handler- Event handler.
-
detach
public void detach()
Description copied from interface:CDPSessionDetaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to send messages.- Specified by:
detachin interfaceCDPSession
-
-