I am trying to write test case using WebDriver, TestNG in Eclipse. Version of WebDriver is 2.39
In the test case I am trying to open a browser, enter site address, once it is loaded, find search field, enter text using Datadriven type from an excel sheet.
Once the first data is entered, I would like to click Return key on keyboard and wait till loads and clear it and enter next test from spreadsheet.
I am successfull in entering text,clearing, but not sure how to write code to press 'Return key' or Enter, please advise.
Apologies, I could not find this in search.
regards,
You can simulate hit Enter key by adding "\n" to the entered text. For example textField.sendKeys("text you type into field" + "\n")
.
upd: BTW, it has been already asked here Typing Enter/Return key in Selenium
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With