2

I need to execute some javascript before the page page loads(= before the javascript on the page is executed)

Is that possible via ghostdriver? using phantomjsdriver 1.2.1 for java, phantomjs 2.0

2
  • Can you edit the html prior to loading the page? You could add a <script> block before the other <script> blocks on the page Commented Jul 22, 2015 at 9:49
  • Thats the question. I have no idea how to do that with phantomjsdriver Commented Jul 22, 2015 at 10:15

1 Answer 1

2

No.

PhantomJS is effectively a browser. You cannot edit a webpage in a browser before the browser has loaded it.

Don't bother trying to disable JavaScript in PhatomJS either because then you won't be able to use JavaScript to inject the JavaScript you need before enabling JavaScript.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.