WebView API
Description
IWebViewAPI is designed for interacting with WebView inside Android applications in ZennoDroid. It allows you to execute JavaScript code, retrieve connection information, and manage certificates.
Methods
EvaluateScript
-
string EvaluateScript(string script)
Executes JavaScript code inside WebView.Parameters:
script— JavaScript code to execute.
Returns:
The result of the script execution as a string.
GetAttachedWebSocketUrl
-
string GetAttachedWebSocketUrl()
Retrieves the WebSocket connection URL.Returns:
A string containing the WebSocket address.Description:
Used for debugging and analyzing WebView connections (e.g. for attaching DevTools).
InjectSystemCertificate
-
void InjectSystemCertificate(string source)
Installs a system certificate.Parameters:
source— path to the certificate or its contents.
Description:
Allows adding a trusted certificate to the system for:- intercepting HTTPS traffic;
- working with proxies (Burp, Charles, Fiddler);
- bypassing SSL pinning (in some cases).
Example
var webView = instance.DroidInstance.WebView;
webView.InjectSystemCertificate(project.Variables["cert_pem"].Value);
EnableForcedRenderWebView
-
void EnableForcedRenderWebView()
Forces the Chromium accessibility tree to remain active.Description:
Bypasses Chromium'sAutoDisableAccessibilityV2feature, which automatically shuts down the accessibility tree when no screen readers (such as TalkBack) are detected as active. Call this method before interacting with WebView elements via Appium if elements are not being found.
DisableForcedRenderWebView
-
void DisableForcedRenderWebView()
Reverts the patch applied byEnableForcedRenderWebView.Description:
Restores Chromium's defaultAutoDisableAccessibilityV2behavior, allowing the browser to shut down the accessibility tree when no screen readers are connected.