CasperJS sometimes fails to submit a form (Windows only)

113 views
Skip to first unread message

Zir Tec

unread,
Apr 10, 2014, 10:36:46 AM4/10/14
to casp...@googlegroups.com
I have a simple casperjs test that submits a form. It always works on my computer (OSX) but fails *most of the time* on Windows 7/8 when executed with other tests.

    casper.test.begin('Search', function(test) {

      casper.start('http://localhost:8080/site', function() {
        this.fill('#search-form, { query: 'good' }, false);
        this.click('#search-form button');
      });

      casper.waitForUrl('http://localhost:8080/site/search', function() {
        test.assertUrlMatch('http://localhost:8080/site/search?query=summary')
      });
    });

Yields (most of the time):

    subject: false

  • The server logs show casperjs/phatomjs tried to access `search` with an empty query.
  • The test works fine when run alone on Windows 7/8.
  • It also works on OSX, even in a test "suite".
  • Another test with a few simple assertExists can break the form submit test.

    $ casperjs --version
    1.1.0-beta3
    $ phantomjs --version
    1.9.7

Something wrong with my script or shall I open an issue? In the affirmative, any workaround?

Thanks

Frederic Close

unread,
Apr 11, 2014, 7:17:33 AM4/11/14
to casp...@googlegroups.com
I have the same kind of problem.

Zir Tec

unread,
Apr 14, 2014, 5:04:09 AM4/14/14
to casp...@googlegroups.com
Now the project manager is threatening to move to Selenium or something, this is going in the wrong direction.

Any pointer or idea? Should I file a bug report on github?

Andy Orahood

unread,
Apr 16, 2014, 8:30:19 PM4/16/14
to casp...@googlegroups.com
I just opened an issue on github for something that appears to be similar: https://github.com/n1k0/casperjs/issues/889. Maybe you could add to that ticket.

Zir Tec

unread,
Apr 17, 2014, 3:02:01 AM4/17/14
to casp...@googlegroups.com
Hello,

I raised an issue slightly before you: https://github.com/n1k0/casperjs/issues/887

But even with the this.fill(..., false) + form.click followed by a waitForUrl -- which is advised indeed, but not in the doc -- my problem remains.

Added a link to your issue anyway.
Reply all
Reply to author
Forward
0 new messages