How to simulate pressing enter in html text input with Selenium?

In a web interface, I've got a text field. When user enters text and accepts with enter, application performs an action.

I wanted to test the behavior with Selenium. Unfortunately, invoking 'keypress' with chr(13) insert representation of the character into the field.

Is there a way other then submitting the form? I'd like to mimic intended user interaction, without any shortcuts...


This Java code works for me:

selenium.keyDown(id, "\\13");

Notice the escape. You probably need something like chr(\13)

Need Your Help

JFrame to be displayed when the event occurs?

java swing jframe

I have a JFrame which pops up when the event occurs. I am having a functionality which when the event occurs the JFrame pops up and if we click on that Frame it will open the corresponding frame, b...

Why won't print in jsp?

java jsp inputstream bufferedreader

The code below doesn't print in jsp (the out.println in while{} ) but it works like a charm in Java program. Can you please explain me why won't print in jsp and what should I change in code? Than...