Package com.microsoft.playwright.impl
Class WorkerImpl
java.lang.Object
com.microsoft.playwright.impl.LoggingSupport
com.microsoft.playwright.impl.ChannelOwner
com.microsoft.playwright.impl.WorkerImpl
- All Implemented Interfaces:
Worker
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.microsoft.playwright.Worker
Worker.WaitForCloseOptions -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ListenerCollection<WorkerImpl.EventType> (package private) PageImplFields inherited from class com.microsoft.playwright.impl.ChannelOwner
connection, guid, initializer, type -
Constructor Summary
ConstructorsConstructorDescriptionWorkerImpl(ChannelOwner parent, String type, String guid, com.google.gson.JsonObject initializer) -
Method Summary
Modifier and TypeMethodDescriptionReturns the return value ofexpression.evaluateHandle(String pageFunction, Object arg) Returns the return value ofexpressionas aJSHandle.protected voidhandleEvent(String event, com.google.gson.JsonObject params) voidRemoves handler that was previously added withonClose(handler).voidEmitted when this dedicated WebWorker is terminated.url()waitForClose(Worker.WaitForCloseOptions options, Runnable code) Performs action and waits for the Worker to close.private WorkerwaitForCloseImpl(Worker.WaitForCloseOptions options, Runnable code) private <T> TwaitForEventWithTimeout(WorkerImpl.EventType eventType, Runnable code, Double timeout) Methods inherited from class com.microsoft.playwright.impl.ChannelOwner
adopt, disposeChannelOwner, runUntil, sendMessage, sendMessage, sendMessageAsync, toProtocolRef, withLogging, withWaitLoggingMethods inherited from class com.microsoft.playwright.impl.LoggingSupport
logApi, logApiIfEnabled, logWithTimestamp, withLoggingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.microsoft.playwright.Worker
evaluate, evaluateHandle, waitForClose
-
Field Details
-
listeners
-
page
PageImpl page
-
-
Constructor Details
-
WorkerImpl
WorkerImpl(ChannelOwner parent, String type, String guid, com.google.gson.JsonObject initializer)
-
-
Method Details
-
onClose
Description copied from interface:WorkerEmitted when this dedicated WebWorker is terminated. -
offClose
Description copied from interface:WorkerRemoves handler that was previously added withonClose(handler). -
waitForEventWithTimeout
private <T> T waitForEventWithTimeout(WorkerImpl.EventType eventType, Runnable code, Double timeout) -
waitForClose
Description copied from interface:WorkerPerforms action and waits for the Worker to close.- Specified by:
waitForClosein interfaceWorker- Parameters:
code- Callback that performs the action triggering the event.
-
waitForCloseImpl
-
evaluate
Description copied from interface:WorkerReturns the return value ofexpression.If the function passed to the
Worker.evaluate()returns a Promise, thenWorker.evaluate()would wait for the promise to resolve and return its value.If the function passed to the
Worker.evaluate()returns a non-[Serializable] value, thenWorker.evaluate()returnsundefined. Playwright also supports transferring some additional values that are not serializable byJSON:-0,NaN,Infinity,-Infinity. -
evaluateHandle
Description copied from interface:WorkerReturns the return value ofexpressionas aJSHandle.The only difference between
Worker.evaluate()andWorker.evaluateHandle()is thatWorker.evaluateHandle()returnsJSHandle.If the function passed to the
Worker.evaluateHandle()returns a Promise, thenWorker.evaluateHandle()would wait for the promise to resolve and return its value.- Specified by:
evaluateHandlein interfaceWorker- Parameters:
pageFunction- JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is automatically invoked.arg- Optional argument to pass toexpression.
-
url
-
handleEvent
- Overrides:
handleEventin classChannelOwner
-