public final class

JavaScriptBridge

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

Class Overview

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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public JavaScriptBridge ()

Public Methods

public static 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.

public 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.

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