Skip to content

Instantly share code, notes, and snippets.

@artjomb
Created March 18, 2015 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artjomb/5e6f12b525789d81856c to your computer and use it in GitHub Desktop.
Save artjomb/5e6f12b525789d81856c to your computer and use it in GitHub Desktop.
keyPressLeft.js
var casper = require('casper').create();
casper.start("http://stackoverflow.com/contact", function(){
this.capture("test37_1.png"); // ""
this.sendKeys("#search > input", "abcd", {keepFocus: true});
this.capture("test37_2.png"); // "abcd"
this.page.sendEvent("keypress", casper.page.event.key.Left);
this.page.sendEvent("keypress", casper.page.event.key.Left);
this.sendKeys("#search > input", "12");
this.capture("test37_3.png"); // "ab12cd"
}).run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment