1

I am writing a spider script,and I need the spider to get content generated by javascript,I heard htmlunit will execute javascript.My script is php,how do I get work with htmlunit? Is there a php equivalent?

Vontio
  • 191
  • 4
  • 12

1 Answers1

1

This answer says no. I'm inclined to think that's still true. That answer says that you PHPUnit with Selenium RC may work.

You may also be able to use SimpleTest.

The other option would be to hand the page response over to a command-line call to Java to do the dirty work, using htmlunit.

Community
  • 1
  • 1
Jared Farrish
  • 48,585
  • 17
  • 95
  • 104
  • http://stackoverflow.com/questions/2325631/selenium-vs-simpletest-vs-watin This link told SimpleTest does not support javascript,command-line call is a choice.Thanks. – Vontio Oct 23 '11 at 15:10
  • 1
    @JimmyIlenloa This is a really old answer, I would probably recommend looking at a [headless browser](http://jonnnnyw.github.io/php-phantomjs/) these days. – Jared Farrish Mar 10 '18 at 14:18
  • thank you Jared I am checking that out as well, it could be a good alternative for me, HtmlUnit headless browser is nice too, if using Java isn't a problem. – Jimmy Ilenloa Mar 10 '18 at 17:47