When using the fill method, how do you select the button to click?
I want to fill out a form and then click on a specific button. Is it possible to select a button using the casper.fill method?
+3
source to share
1 answer
Not directly with a method fill()
, bu with click()
one:
HTML:
<form name="plop">
<input type="text" name="q">
<input type="submit" name="foo" value="Foo!">
<input type="submit" name="bar" value="Bar!">
</form>
Casper script:
// casperjs script
casper.fill('form[name="plop"]', {
q: 'yeah',
});
casper.click('input[type="submit"][name="bar"]');
+6
source to share