JavaScriptBridge

JavaScriptBridge

public final class JavaScriptBridge
extends Object

java.lang.Object
   ↳ android.support.test.espresso.web.bridge.JavaScriptBridge


Provides a gateway for Java and Javascript code to communicate to eachother.

Summary

Public constructors

JavaScriptBridge()

Public methods

static void installBridge()

Sets up Java / Javascript bridging on every WebView in the app.

static Conduit makeConduit()

Creates a Conduit object which allows Java to wrap Javascript code within a handler that will foward evaluation results back to the Java process.

Inherited methods

From class java.lang.Object

Public constructors

JavaScriptBridge

JavaScriptBridge ()

Public methods

installBridge

void installBridge ()

Sets up Java / Javascript bridging on every WebView in the app.

This method must be called very early (eg: before webviews are loaded in your app). GoogleInstrumentation invokes this method if this library is present on your classpath.

This method must be called from the main thread. It'll return immedately if the bridge is already installed.

makeConduit

Conduit makeConduit ()

Creates a Conduit object which allows Java to wrap Javascript code within a handler that will foward evaluation results back to the Java process.

Conduits can be used for only 1 evaluation. Creating new ones is relatively cheap.

Returns
Conduit