my $mech = WWW::Mechanize::Firefox->new(activate => 1); $mech->autoclose_tab(0); $mech->get('http://facebook.com'); if ($mech->title eq 'Facebook - Log In or Sign Up') { $mech->submit_form( with_fields => { email => 'my@email.com', pass => 'my_password', } ); } sleep(1); $mech->get('https://www.facebook.com/PageName/events'); my $page_id = 777777777777777; $mech->click({ synchronize => 0, xpath => '//a[text() = "Create Event"]' }, 10, 10); sleep(3); # selects all input fields and sets value to 'hello world' # even though values are set, the fields remain blank despite trying to simulate some js events # per suggestion from Corion, the man himself, at http://www.perlmonks.org/?node_id=1095191 my @selectors = $mech->selector('input'); foreach my $selector (@selectors) { $selector->__event('focus'); $selector->{value} = 'hello world'; $selector->__event('change'); $selector->__event('blur'); } # attempts to publish event, results in form errors because fields are blank $mech->click({ synchronize => 0, xpath => '//button[text() = "Publish"]' });