CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Logging into website

 



paxprobellum
New User

May 16, 2010, 9:32 AM

Post #1 of 8 (1480 views)
Logging into website Can't Post

I would like to write a perl script to login to this website:

http://app001.us1.darkfallonline.com/sf/fwd

My idea was simply:


Code
use WWW::Mechanize; 
my $mech = WWW::Mechanize->new();
$url = "http://app001.us1.darkfallonline.com/sf/fwd";
$mech->get( $url );
$mech->set_visible( $username, $password ) ;


However, this doesn't work. My guess is that since dump() doesn't recognize any forms or links, it doesn't know what to fill in. Also, submit() doesn't work either. Help?


shawnhcorey
Enthusiast


May 17, 2010, 8:50 AM

Post #2 of 8 (1451 views)
Re: [paxprobellum] Logging into website [In reply to] Can't Post

I would try $mech->submit_form() after I got the login page.

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


paxprobellum
New User

May 17, 2010, 9:08 AM

Post #3 of 8 (1449 views)
Re: [shawnhcorey] Logging into website [In reply to] Can't Post


In Reply To
I would try $mech->submit_form() after I got the login page.


Doesn't work. Mechanize doesn't see any forms on the page, so it won't interact with it at all.

Like I said, dump() gives me a few image files, a css file, and an icon. =/


shawnhcorey
Enthusiast


May 17, 2010, 9:28 AM

Post #4 of 8 (1447 views)
Re: [paxprobellum] Logging into website [In reply to] Can't Post

After looking into the site, it runs a Javascript function that is triggered when you click on the login image, which uses AJAX to log in. I'm not sure WWW::Mechanize can handle this. Why don't you try PerlMonks or contact the author of WWW:Mechanize directly?

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


MetalGear
Novice


May 18, 2010, 3:02 AM

Post #5 of 8 (1423 views)
Re: [paxprobellum] Logging into website [In reply to] Can't Post

try using Win32:IEAutomation package.

PS: I am not able to access that page from my office Unimpressed


paxprobellum
New User

May 18, 2010, 6:09 PM

Post #6 of 8 (1405 views)
Re: [MetalGear] Logging into website [In reply to] Can't Post


In Reply To
try using Win32:IEAutomation package.

PS: I am not able to access that page from my office Unimpressed


(It's an online game's web interface. Nothing NSFW.)
I tried Win32::IEAutomation, but wasn't able to get it to click the submit button. I think I covered all my bases...


Code
use Win32::IEAutomation; 
my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1);
$ie->gotoURL('http://app001.us1.darkfallonline.com/sf/fwd');
$ie->getTextBox('name:', "username")->SetValue('username');
$ie->getTextBox('name:', "password")->SetValue('password');

my @alllinks = $ie->getAllLinks();
foreach $l (@alllinks) {
$l->Click(); }

my @allimages = $ie->getAllImages;
foreach $i (@allimages) {
$i->Click(); }

my @alltables = $ie->getAllTables;
foreach $t (@alltables) {
$t->Click(); }



MetalGear
Novice


May 18, 2010, 9:04 PM

Post #7 of 8 (1399 views)
Re: [paxprobellum] Logging into website [In reply to] Can't Post

to find the specific button u want to click,

view source of that page, and find out the "name" or "value" or any other attribute related to that button.

ex: if name of button is "submit", just search for submit in source file of website and look for its vakue or name.

then


Code
  

$ie->getButton('caption:', "Google Search")->click();

$ie->getButton('name:', "btnG")->click();



etc...

the above is for google site.

if u r getting a popup asking for password, then again its differenr scenario.


paxprobellum
New User

May 19, 2010, 9:22 AM

Post #8 of 8 (1366 views)
Re: [MetalGear] Logging into website [In reply to] Can't Post

What I want to press is a cell of the table. I wasn't able to find a method to "get" it. It doesn't have any distinguishing ids.

Also, I have read the documentation thoroughly. I understand the ideas. I'm having problem with implementation.

I have tried tableCells() and rows() functions, but they do not work. Return a "method not found" error.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives