use WWW::Mechanize; use WWW::Mechanize::Firefox; # open firefox my $firefox = WWW::Mechanize::Firefox->new( create =>1, activate=>1, launch=>'/usr/bin/firefox', ); # stop timeout issues with firefox telnet my $url='some url'; my $new_timeout=100000; $firefox->repl->repl->client->{telnet}->timeout($new_timeout); $firefox->get($url); # log-in process $firefox->click({xpath=>'//*[@id="signInLink"]'}); sleep 60; my $username='username'; my $password='password'; # sign-in process $firefox->form_id('sign-in-form'); $firefox->set_visible($username, $password ); sleep 60; $firefox->click({xpath=>'//*[@id="button-sign-in"]'}); sleep 30; print "now logged-in\n"; # trying to get mechanize to use current mechanize::firefox session my $user_agent_name='Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:39.0) Gecko/20100101 Firefox/39.0'; my $agent = WWW::Mechanize->new(agent=>$user_agent_name); my $content = $agent->content(); print $content;