I'm writing Selenium test scripts using Java for an application built in ExtJs. I have an input field in one of the page which is attached to 'onchange' event. Whenever user modifies the text in the field, onchange event is triggered. I'm using WebDriver sendKeys() to modify the text in the field. So whenever text is modified, 'onchange' event is triggered in Firefox and Chrome (as expected) but its not getting triggered in IE9.0. I have searched all over the net for the solution, but didn't find one. So please can someone help me on this? Let me know more info is required
sendKeys() not working in Selenium WebdriverSelenium can run JavaScript commands with the help of the executeScript method. JavaScript command to be used is passed as a parameter to this method. To input text we shall first identify the edit field with the JavaScript method document. getElementsByClassName.
New Selenium IDE We can input text in the text box without the method sendKeys with thehelp of the JavaScript Executor. Selenium executes JavaScript commands with the help of the executeScript method.
You can either click on a different element on the field, or perhaps the easier way is to tab off of the field after the input is finished.
In the ExtJS applications I've automated, I'll always tab off of the field after performing the input, which fires all of the correct events.
Using C# as an example:
IWebElement element = driver.FindElement(By.Id("some_input_field"));
element.SendKeys("test input")
element.SendKeys(Keys.Tab);
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