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

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


This Java code works for me:

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

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


I ended up using selenium.keyPress(id, "\\13");


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;" ?