javascript - How to trigger keyboard's 'Enter' key -


the current scenario is, need change existing title new title , not able trigger keyboard's "enter" key while automation. below program have written

var z = casper.evaluate(function triggerkeydownevent() { jquery(".jqtree-selected > div:nth-child(1) > span:nth-child(1)").text("hihello"); this.wait(5000); var e = jquery.event("keydown"); e.which = 13; e.keycode = 13; jquery("jqtree-selected > div:nth-child(1) > span:nth-child(1)").trigger(e); return true; }); 

i can see name changing failing trigger enter key.

use jquery.event("keypress") instead of jquery.event("keydown").

also, try putting element in variable first use trigger event.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -