javascript variables not assigning correctly

View previous topic View next topic Go down

javascript variables not assigning correctly

Post by whitefoxsniper on Fri Aug 17, 2012 10:10 pm

I am trying to get the raw HTML of the page with this:

Code:

var info; $.get('webpage', function(data) { $('.response').html(data);info = data;}); alert(info);

In firefox running without selenium I get the pages raw html in a alert box. In selenium i use this:

Code:

((JavascriptExecutor)driver).executeScript("var info; $.get('webpage', function(data) { $('.response').html(data);info = data;}); alert(info);", "");

and info is undefined.

However this (alert inside function):

Code:

((JavascriptExecutor)driver).executeScript("var info; $.get('webpage', function(data) { $('.response').html(data);info = data; alert(info);});", "");

outputs the correct info. Is there any way to get the value of data from the function?

whitefoxsniper

Posts : 1
Join date : 2012-08-17

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum