How can I get dynamic web content using Perl?

It is quite difficult. There is a web page like this which I believe uses some kind of AJAX to render content based on a search query. When I fetch the page using get in Perl, it fetches the script code behind the php / html, but not the results that are shown when I manually search for the query. I need to get the content of the results page. Is there anyway to do this in Perl?

+2


source to share


2 answers


Have a look at Selenium RC and WWW::Selenium

Perl. With them, you can control a real web browser.



Another option is WWW::HtmlUnit

that uses the HtmlUnit Java library to execute JavaScript without a web browser. WWW::HtmlUnit

uses Inline :: Java to give Perl access to the library. I found it better to say "No" to the question "Do you want to build a JNI extension?" During installation.

+6


source


If you are writing tests that need to be validated on the page, you can take a look at Schwern's javascript-tap-harness which works with Selenium and handles all forests.



I also found Using WWW :: Selenium to test or automate an Ajax site is quite helpful.

+3


source







All Articles