Welcome Guest Search | Active Topics | Sign In | Register

WebBrowser - Javascript result issue Options
Stefan Koell
Posted: Monday, August 1, 2016 10:17:31 AM
Rank: Advanced Member
Groups: Member

Joined: 12/23/2013
Posts: 115
Hi,

I'm invoking a script in the browser to fill in elements and the script will return a JSON string with all the result details, something like this:
{"AllFieldsFound":true,"AutoFillMappings":[{"Mode":"ReplaceValue","Name":"","Selector":"input#username","Result":1},{"Mode":"ReplaceValue","Name":"","Selector":"input#pwd","Result":1},{"Mode":"Click","Name":"","Selector":"button#submit.login-btn.qStr.submit","Result":1}]}

I'm doing this on IE and the EO.WebView and in IE I get the whole string which I then can parse to my object. In Chrome I use a code like this:
Code: C#
var scriptCall = new ScriptCall(javaScript);
            Browser.WebView.QueueScriptCall(scriptCall);
            scriptCall.WaitOne();
            var r = scriptCall.Result;

In scriptCall.Result I expected to see the complete string but I only have the value 1 in it (I assume this is the last result bit of the json string.

Am I doing something wrong?

Regards,
Stefan
eo_support
Posted: Monday, August 1, 2016 12:37:25 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You have to return a single string value instead of a complex object. For example, instead of

Code: JavaScript
return value;


You can do:

Code: JavaScript
return JSON.stringify(value);


This will convert the complex object into a single string value and you will see the whole JSON string on the .NET side.

Thanks!
Stefan Koell
Posted: Wednesday, August 3, 2016 7:56:45 AM
Rank: Advanced Member
Groups: Member

Joined: 12/23/2013
Posts: 115
Thanks, that helped!

Regards,
Stefan
eo_support
Posted: Wednesday, August 3, 2016 11:00:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Great. Please feel free to let us know if there is anything else.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.