SeeTestAutomation- HybridRunJavaScript
Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .
HybridRunJavascript**(WebViewLocator, Index, Script)**
Description
Run Javascript in a WebView.
Parameters
- WebViewLocator - WebView locator string like id=web or empty for the first WebView in page - will be Empty
- Index - Element index - will be set to 0
- Script - Javascript (if you would like the command to return a value - just enter result=<javascript>) - will be set to var result = document.cookie;
Usage
Scenario: In the following example I will save the web page cookies names into a string.
Command usage: This command is useful for all special cases where standard SeeTestAutomation commands fail to work. In addition, by using this command, the user can access element and API that are not accessible in any other way.
Code Examples
Java Example
String str0 = client.hybridRunJavascript("", 0, "var result = document.cookie;");
C# Example Expand source
String str0 = client.hybridRunJavascript("", 0, "var result = document.cookie;");
VBScript Example Expand source
str0 = client.HybridRunJavascript ( "", 0, "var result = document.cookie;" )
Report
Python Example Expand source
var0 = self.client.hybridRunJavascript("", 0, "var result = document.cookie;")
Perl Example Expand source
my $str0 = $client->hybridRunJavascript("", 0, "var result = document.cookie;");