14
I’m looking for a way to simulate keypress
of shift + 1
via javascript to create an exclamation mark !
for a series of tests (specs) in a framework in which I am involved.
I have used a framework (Syn) , example of jsFiddle, but I can’t get through it to play/fire the event of a keypress shift + 1
.
According to the documentation would be:
Syn.type('JavaScriptMVC[shift]1[shift-up]', 'elementID')
But I didn’t succeed in detecting the .shiftKey == true
at the event.
There is another way using "pure javascript" ?
I tried to use this answer in the OR without success and I realized that the createEvent
is depressed and I have not found another way.
The test must necessarily be written in javascript... otherwise it could use some browser automation tool, such as the Selenium
– Miguel Angelo
Or else the Phantomjs... which allows writing javascript scripts to manipulate the browser, which is a headless Webkit.
– Miguel Angelo
Why not use Jquery and with it you make a Rigger event?
– cavalsilva
Managed to resolve this issue Sergio?
– durtto
@durtto yes and no. For modern browsers Syn works. For IE<8 no.
– Sergio
I am in this situation(little like) and I am in search of the best code. About IE<8 I have no worry because I told you which browser to use.
– durtto