Forum Discussion

Hansjohann's avatar
Hansjohann
New Member
8 years ago

Example of evaluateJavascript() usage in Webview for Smartbearbrowser on Android device

 

Mobile.Device().Process("*SmartBearBrowser").FindChild("ObjectType", "WebView", 2).evaluateJavascript("(function() { return null; })();", new ValueCallback<String>() {
    @Override
    public void onReceiveValue(String s) {
        Log.d("LogName", s); // Prints the string 'null' NOT Java null
    }
});

 

The above example doesn't seem to work (Error 100). I also can't create ValueCallback's in generell ...

 

Mobile.Device().Process("*SmartBearBrowser").FindChild("ObjectType", "WebView", 2).evaluateJavascript(script, ???)

 

Is were an Example on how to write the Statemant correctly in Testcomplete ?

  • YuriPeshekhonov's avatar
    YuriPeshekhonov
    SmartBear Alumni (Retired)

    Hello,

     

    It looks like you copied the code from the StackOverflow thread and I think it's expected that it doesn't work in TestComplete.

     

    It's not clear what you want to do. Could you describe your scenario in detail? What actions does the JavaScript code perform and what results do you need to get from it?

     

    JFYI, you can contact the Support team in this regard, if you have an active maintenance subscription.