jeanphix/Ghost.py

wait for onload event

ruester opened this issue · 1 comments

It seems that Ghost.py is not waiting until the web page is fully loaded or is ignoring the onload event and similar constructs such as jQuery's $(window).load(function(){});.

<html>
<head>
  <script type="text/javascript">
    globalvar = 1;

    function doSomething() {
        globalvar = 2;
    }
  </script>
</head>
<body onload="doSomething()">
    <!-- CONTENT -->
</body>
</html>

Which will result in:

session.wait_for_page_loaded()
session.evaluate("globalvar;")
==> 1

However one of the forks (https://github.com/carrerasrodrigo/Ghost.py) seems to have implemented the feature: open(url, wait_onload_event=True).

Is there a way to achieve the same behaviour with the Ghost.py version of your repository?

there was an undefined method in the doSomething() method which firebug did not detect as an error...
everything works fine now