Phantomjs: function send keypress event not working with enter

I am trying to automate some things with phantomjs only. Doing the same job with casperjs works, but the challenge is to make it work with phantomjs only. I want to hit enter on the normal textbox I'm focusing on.

page.sendEvent('keypress', page.event.key.A); //this works
page.sendEvent('keypress', page.event.key.Enter); //this doesn't work

      

The script runs without any error, but in the output I see that the input event is not working.

I tested another function that worked:

page.sendEvent('keypress', page.event.key.A); //this works
page.sendEvent('keypress', page.event.key.Backspace); //this works

      

Why is the input only event not working? Any other key works. Is there a way to do this with keycodes?

+3


source to share





All Articles