I want to set the value of a certain formless input field.
my $field = $w->selector('tr.edit td[data-attribute="name"] input', single => 1);
finds it.
$field->attributes->{value} = 'test';
has no apparent effect.
Both
$w->field($field => 'test');
and
$w->field('tr.edit td[data-attribute="name"] input' => 'test');
error out with No elements found for form number 1
.
When I ran into this problem, I would just use the eval
method and let Javascript (or jQuery if it's loaded in the page) take care of selecting and setting values. For me it was mostly selecting drop-downs, where the Angular application on the page required a change or click event.
$mech->eval( q{$(tr.edit td[data-attribute="name"] input).val('test')} );
If there is no jQuery I am sure your Google fu will help you out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With