When using the fill method, how do I choose the button to press?

casperjs

Solution

Not directly with the `fill()` method, bu with the `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"]');

Problem

I want to fill a form then press a specific button. Is it possible to choose the button using casper.fill method?

Original source