my ($node) = $mech->xpath('//input[@id="foo"]'); $mech->set_field( field => $node, value => 'Your value here', );