Selenium Web Driver access Javascript global variable in Jquery
===

I am trying to run a functional test in Python using Selenium, and I want to retrieve the value of a global variable in Javascript that has been declared on a certain page. 

Normally `browser.execute_script("return globalVar;")` works fine, but this variable is declared within `$(document).ready(function(){`, and Selenium can't locate it.

So Selenium can return the variable when it's declared like this:

    var globalvar = 0;
    $(document).ready(function(){
    });

but not like this:

    
    $(document).ready(function(){
        var globalvar = 0;
    });

Is there anyway I can use Selenium to return the value of the javascript global variable from within the Jquery document ready?