javascriptc#jqueryawesomium

Execute javascript 'undefined' output but it work as expected


I am trying to click a button from a website

This is the code of that website

<input name="Submit" type="submit" value="submit" class="buttons">

I use awesomium and c# to do this

And below is my sample code

wb.ExecuteJavascriptWithResult(@"document.getElementsByName('Submit')[0].click();");

In my output log of Visual studio the result is 'undefined' but it click the button in the website and it generates output as expected. But i want to learn the reason of the error. But it doesn't give me any more error.

In order to check if its an error of awesomium. I load the website in google chrome and executed the javascript in the console and the output is the same. it gives me undefined but it clicks the button and generate output.

I don't have much knowledge of javascript. But how can i solve this kind of issue?

Regards, Meco


Solution

  • When a function does not have an explicit return value, undefined is returned by default. Nothing wrong here.

    More info here, awesome answer by the way !