in reply to Re^3: WWW::Mechanize::Chrome Instagram
in thread WWW::Mechanize::Chrome Instagram
#!/usr/bin/perl # hash-bang / she-bang / sh-bang use strict; use warnings; use Log::Log4perl ':easy'; use WWW::Mechanize::Chrome; use open ':std', ':encoding(UTF-8)'; sub main () { my $mech; my $res; my $url; my $cookies; my $username; my $password; my $user; my $pass; my @formlist; $user = 'www'; $pass = 'zzzz'; $url = "https://www.instagram.com/accounts/login/?source=auth_swit +cher&hl=en"; $mech = WWW::Mechanize::Chrome->new( launch_exe => 'chromium', launch_arg => ["--no-sandbox", "--disable-setuid-sandbox", + "--remote-debugging-port=9222", "--headless"], ); $mech->allow( javascript => 1 ); $mech->get($url); if ($mech->success()) { $mech->sleep(1); + # waiting for load site $mech->form_number(1); $mech->value( username => $user ); $mech->value( password => $pass ); $mech->eval_in_page(<<'JS'); var cls = document.getElementsByClassName('_0mzm- sqdOP L3NKy + '); Array.prototype.forEach.call(cls, (item) => item.removeAttribu +te('disabled')); JS $mech->click({intrapage => 1, text => 'Log In', single => 1 }) +; $mech->sleep(2); print $mech->content; } else { print "Not connect to: ".$url."\r\n"; } return 0; } main ();
Now i manually remove disable attribute from button, request send when i click Log in but get me error "The username you entered doesn't belong to an account. Please check your username and try again." when I'm definitely entering the correct data, it looks like he didn't see the login and password completed before sending, this error is probably displayed for an empty login. Anyone have any idea how to log in correctly?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: WWW::Mechanize::Chrome Instagram
by jcb (Parson) on Sep 06, 2019 at 23:41 UTC | |
by damian1 (Novice) on Sep 08, 2019 at 12:56 UTC | |
by Corion (Patriarch) on Sep 08, 2019 at 13:12 UTC | |
by damian1 (Novice) on Sep 08, 2019 at 13:30 UTC | |
by Corion (Patriarch) on Sep 08, 2019 at 16:48 UTC | |
|