How to execute Javascript code and get a value back

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

How to execute Javascript code and get a value back

Postby garfield » Sat Jun 28, 2014 10:37 am

I am trying to do some automation.
When a page is loaded i want to fill form input fields with some values, select an item in dropdowns and click the submit button.
I think, this can be done by calling the ExecuteJavaScript function.
When someone could provide sample code for this, i would really apreciate it, it would be a big time saver for me.

But to my real question for now:
How to execute Javascript code and get a value back (either directly or with some synchron or asynchron callback) ?
I know, there are some similar questions posted but that did not pointed me to a solution for me.
garfield
Newbie
 
Posts: 2
Joined: Sat Jun 28, 2014 10:08 am

Re: How to execute Javascript code and get a value back

Postby magreenblatt » Sat Jun 28, 2014 11:54 am

magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: How to execute Javascript code and get a value back

Postby garfield » Sat Jun 28, 2014 2:50 pm

Thanks for the hint.
This gives me an idea about how to create a variable in the browser that can be later accessed and changed from javascript.
I could create a variable "myjavascriptfunctionresult".
I can then execute Javascript code that changes the value of the created variable.
But at the moment i have no idea how to query the value of "myjavascriptfunctionresult" after calling the ExecuteJavaScript function.
Probably i simply don't understand something, i think i must spend some hours and days with research and trial and error.
garfield
Newbie
 
Posts: 2
Joined: Sat Jun 28, 2014 10:08 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 10 guests