How to open HTML page in a browser with specific options selected in drop-down boxes?

Hi Everybody,

The task that I have is from Perl script to open HTML page in a browser with specific options selected in drop-down boxes and edit fields using POST method.

The good example of such a page would be http://stockcharts.com/h-sc/ui. So if I do that manually:

I open the link in a browser,
type Symbol: $COMPQ,
select Chart Attributes\Range: 3 Month,
select Overlays\first row\first column: Exp Mov. Avg,
type Overlays\first row\second column: 5,
click on Update button.

The page gets updated according with the specified parameters.

So how can I get the same result using Perl?

I tried to search for the solution, but haven’t found anything directly related to my problem. So please point me to the source if the answer already exists somewhere else.

Thank you,

J

You will want to look into WWW::Mechanize if you intend to use perl.

http://search.cpan.org/author/PETDANCE/WWW-Mechanize-1.30/lib/WWW/Mechanize.pm
http://search.cpan.org/author/PETDANCE/WWW-Mechanize-1.30/lib/WWW/Mechanize/Examples.pod
http://search.cpan.org/author/PETDANCE/WWW-Mechanize-1.30/lib/WWW/Mechanize/FAQ.pod


There are also some modules written for gathering stock data.

http://search.cpan.org/~hampton/Finance-Quote-1.13/lib/Finance/Quote.pm

I have never used any of the above modules so I can't really help much more than I already have.

this will most likely be very difficult for you unless you already have solid perl experience and know how to install the modules.

Thank you, KevinADC.

I will look through the sources you suggested. Though my goal is not to gather stock data. The web page I mentioned was just a convenient public domain example. I am not an experienced Perl programmer and my goal is to learn how to operate with the HTML/scripts in the web browser, not just data collecting/processing.

I appreciate it anyway.

J

Hi all.

Can i open the web page through perl?
I get URL as a result in my perl code.
but, ofcourse, it is displayed in command prompt as i'm using windows.
I need that web page to be displayed directly.
can i do it?

i hope somebody can help with this.

thank you
chandrag

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.