Page 1 of 1

How to execute Javascript code and get a value back

PostPosted: Sat Jun 28, 2014 10:37 am
by garfield
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.

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

PostPosted: Sat Jun 28, 2014 11:54 am
by magreenblatt

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

PostPosted: Sat Jun 28, 2014 2:50 pm
by garfield
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.