0

If I point phantomjs to this page:

<html>
<body>
<script>
    $(document).ready(function () {
        atesting();
    });
</script>
</body>
</html> 

with this phantomjs script

var page = require('webpage').create();
page.open('http://testpage.com', function(status) {
  console.log("Status: " + status);
  if(status === "success") {
    page.render('testpage.png');
  }
  phantom.exit();
});

will it:

  1. call the “atesting()” function or
  2. will it not call it or
  3. will it “maybe sometimes” call the function because it might stay on it long enough so that the function is called?

1 Answers1

0

After some tests, it seems that the page is rendered before the document is ready. So the atesting() function will not be called.

If you want to render the page after the document is ready, see this answer : How can I wait for the page to be ready in PhantomJS?