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

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

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

[{'answer_id': 71580, 'author': 'Scott Gowell', 'author_id': 6943, 'author_profile': 'https://Stackoverflow.com/users/6943', 'pm_score': 0, 'selected': False, 'text': '<p>Though I haven\'t tested this I imagine you can use "\\r\\n" appended to a string to simulate a new line. If not look for the languages equivalent to "Environment.NewLine;" ?</p>\n'}, {'answer_id': 71876, 'author': 'Peter Bernier', 'author_id': 6112, 'author_profile': 'https://Stackoverflow.com/users/6112', 'pm_score': 0, 'selected': False, 'text': "<p>It's been a while since I've had to do this, but I seem to recall having to use a javascript snippet to execute the carrage return as opposed to using the Selenium keypress  function.</p>\n"}, {'answer_id': 71902, 'author': 'noah', 'author_id': 12034, 'author_profile': 'https://Stackoverflow.com/users/12034', 'pm_score': 4, 'selected': True, 'text': '<p>This Java code works for me:</p>\n\n<pre><code>selenium.keyDown(id, "\\\\13");\n</code></pre>\n\n<p>Notice the escape. You probably need something like chr(\\13)</p>\n'}, {'answer_id': 531011, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>I ended up using selenium.keyPress(id, "\\\\13");</p>\n'}, {'answer_id': 21807435, 'author': 'user1710861', 'author_id': 1710861, 'author_profile': 'https://Stackoverflow.com/users/1710861', 'pm_score': 0, 'selected': False, 'text': '<p>you can use\nWebelement.sendkeys(Keys.Enter);</p>\n'}]
['https://Stackoverflow.com/questions/71561', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9622/']