WebBrowser

class WebBrowser(sessionId: String, httpRequestInfo: HttpRequestInfo, kweb: Kweb)

A conduit for communicating with a remote web browser, can be used to execute JavaScript and evaluate JavaScript expressions and retrieve the result.

Constructors

WebBrowser
Link copied to clipboard
fun WebBrowser(sessionId: String, httpRequestInfo: HttpRequestInfo, kweb: Kweb)

Types

CatcherType
Link copied to clipboard
enum CatcherType : Enum<WebBrowser.CatcherType>
FuncDeclaration
Link copied to clipboard
data class FuncDeclaration(js: String, params: String)
OutboundMessageCatcher
Link copied to clipboard
data class OutboundMessageCatcher(catcherType: WebBrowser.CatcherType, functionList: MutableList<FunctionCall>)

Functions

batch
Link copied to clipboard
fun batch(catchingType: WebBrowser.CatcherType, f: () -> Unit)
callJsFunction
Link copied to clipboard
fun callJsFunction(jsBody: String, vararg args: JsonElement)
Calls a JavaScript function in the browser passing it the supplied arguments, which will be substituted into jsBody wherever a {} is present.
callJsFunctionWithCallback
Link copied to clipboard
fun callJsFunctionWithCallback(jsBody: String, callbackId: Int, callback: (JsonElement) -> Unit, vararg args: JsonElement)
Calls a JavaScript function that can return a value via a callback
callJsFunctionWithResult
Link copied to clipboard
suspend fun callJsFunctionWithResult(jsBody: String, vararg args: JsonElement): JsonElement
catchOutbound
Link copied to clipboard
fun catchOutbound(catchingType: WebBrowser.CatcherType, f: () -> Unit): List<FunctionCall>
Execute a block of code in which any JavaScript sent to the browser during the execution of the block will be stored and returned by this function.
generateId
Link copied to clipboard
fun generateId(): String
isCatchingOutbound
Link copied to clipboard
fun isCatchingOutbound(): WebBrowser.CatcherType?
Are outbound messages being cached for this thread (for example, because we're inside an immediateEvent callback block)?
removeCallback
Link copied to clipboard
fun removeCallback(callbackId: Int)

Properties

doc
Link copied to clipboard
val doc: Document
gurl
Link copied to clipboard
val gurl: KVar<URL>
The absolute URL of the page, mapped to a io.mola.galimatias.URL for convenience.
htmlDocument
Link copied to clipboard
val htmlDocument: AtomicReference<Document?>
During page render, the initial HTML document will be available for modification as a JSoup Document in this AtomicReference.
httpRequestInfo
Link copied to clipboard
val httpRequestInfo: HttpRequestInfo
kweb
Link copied to clipboard
val kweb: Kweb
outboundMessageCatcher
Link copied to clipboard
Allow us to catch outbound messages temporarily and only for this thread.
url
Link copied to clipboard
val url: KVar<String>
The URL of the page, relative to the origin - so for the page http://foo/bar?baz#1, the value would be /bar?baz#1.
window
Link copied to clipboard
val window: Window