I\'m trying to write a test using CasperJS for a scenario where pressing Enter in an input is the trigger for the page to do something with the text otherwise typed into the
You might want to add {keepFocus: true} to the first sendKeys call. If you see the source code, without adding a keepFocus, it is blurring the text area and that means your second sendKeys call will not accept the keypress.
This seems to work.
casper.start('http://localhost:3000/input-demo', function() {
this.sendKeys('#demo-input', 'demo text', {keepFocus: true});
this.sendKeys('#demo-input', casper.page.event.key.Enter , {keepFocus: true});
this.test.assertEquals(this.getHTML('#stage'), 'input demo');
});
casper.run();