1

I'm trying to use CasperJS to select both options in a multiple select in an HTML form:

<select id="bldgs" name="bldgs" multiple="multiple" size="6" autocomplete="off">
    <option value="249759290">Southeast Financial Center - Annex</option>
    <option value="245625689">Southeast Financial Center - Tower</option>
</select>

Casper code:

casper.each(testData, function(self) {
  self.thenOpen('<link to form here>', function() {
    this.echo("Successfully opened form.");
    var name = testData[i];
    this.fill('form#vendor', { 
        'orgnm': name,
        'bldgs': ["249759290", "245625689"],
    }, false);
    this.echo("Inserted company " + testData[i]);    
    i++;
});

Everything else in the form is properly filled out, and when I try and select only one option from the multiselect it works fine. However, when I try and select both, neither of them get selected. This problem persists on other multiselect items too. I'm not sure what I'm doing wrong, since this seems to be the correct syntax according to the docs and all efforts at debugging this problem have failed. Any ideas?

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
  • Possible duplicate of [CasperJS/ Javascript Selecting Multiple Options](http://stackoverflow.com/questions/30986521/casperjs-javascript-selecting-multiple-options) – Artjom B. Mar 29 '16 at 19:44

1 Answers1

0

It is not implemented in the current (and previous) version 1.1-beta3. You will have to use the master branch from github of CasperJS where it is implemented.

Relevant GitHub Issue: Add support for multiple select in Casper.fill()

Relevant GitHub Pull Request: Add ability to fill multiselect in forms

Artjom B.
  • 61,146
  • 24
  • 125
  • 222