$mech->field('#foo', 'bar'); # set value of element with id "foo" to "bar"