Send :return
instead of enter:
. This answer talks about the difference.
Enter key event shows no effect in Selenium webdriver (Ruby bindings)
-
29-06-2023 - |
Question
I am trying to enter a value in an input box and immediately hit enter to trigger a function via Selenium Webdriver & ruby. The problem is the value is reflected into input filed but the enter event is not triggered.
Below is my code for same:
elements = browser.find_elements(:css,".formProperty.fpMandatory.fpUpdateable .off .collapsedView.Uncompleted .fpColValue .textFieldValueSelector.valueSelector .integer")
elements[0].send_keys"5"
elements[1].send_keys"5"
elements[2].send_keys"2"
elements[2].send_keys(:enter)
Any work around please?
Thanks, Abhishek
Solution
OTHER TIPS
I think this will work for you:
elements[2].send_keys"2", :enter
Second suggestion:
elements[2].send_keys"2"
browser.action.click(elements[2]).send_keys(:enter).perform
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow