How Perl can interact with ajax form

I am writing a perl program that ran a simple get command to get the results and process them. But the site has been updated and now has a java component that processes the results (therefore, the actual data is no longer in the source code).

This is the site: http://wro.westchesterclerk.com/legalsearch.aspx

Try to enter:
Index: 11103
Year: 2009

I want to programmatically enter “index number” and “year” at the bottom of the form, where it says “search by number”, and then retrieve the results listed next to it.

I have written many programs in Perl that simply pass variables to a URL, and the results are listed in the source code, so it's easy to parse. (Using LWP: Simple)

how

$html = get("http://www.url.com?id=$somenum&year=$someyear")

But this is completely new to me, and I don’t know where to start. I am a little familiar with LWP: UserAgent and Mechanize.

I would really appreciate any help.

Thank!

+3
source share
3 answers

It may be more logical to use one of the modules that controls the browser. Something like Mozilla :: Mechanize or Selenium tools.

The browser knows better how to interact with the server using AJAX and redisplay the DOM, etc., so create a script on top of this feature.

+2
source

. Wireshark.

- , , POST. Javascript .

+3

, , . , .

A: javascript. , "ajax", / - . , , , get. firebug , javascript.

: - ( URL- javascript, , firefox). , .

http://wro.westchesterclerk.com/legalsearch.aspx
javascript: function go() { document.getElementById('ctl00_tbSearchArea__ctl1_cphLegalSearch_splMain_tmpl0_tbLegalSearchType__ctl0_txtInde    xNo').value=11109; document.getElementById('ctl00_tbSearchArea__ctl1_cphLegalSearch_splMain_tmpl0_tbLegalSearchType__ctl0_txtYear').value='09';searchClick();} go();

This is the method we used with mozembed to programmatically get around this stuff. We recently switched to the Web Kit . And to remove this from watching the video, we used Xvfb / Xvnc to create a virtual desktop to load the browser.


These are the methods that I have come up with so far. Let me know if you come up with something else. Also I hope that helped.

0
source

Source: https://habr.com/ru/post/1736571/


All Articles