my $mech = WWW::Mechanize->new( agent =>$browser_agent); $mech->cookie_jar(HTTP::Cookies->new()); $mech->get($url_login); $mech->form_number($form_nummer); $mech->field('username' => $username); $mech->field('password' => $password); $mech->click(); <--- I think this is where the error gets trown, if the "username" textbox is not present