I am typing some value, on change do a total. But somehow, this event is not getting fired with selenium type command.
I also tried typeKey and typeAt ..But no success. Any workaround for this ?
TYPE Command TYPE sets the value of an input field, as though you typed it in.
Record and playback is one of the key features of Selenium IDE, among other features that help manual testers get a taste of automation and its benefits. Selenium IDE has a rich set of commands powered by Selenese, allowing you to record various interactions of a web app with the browser.
To trigger the onchange event, try adding this command in Selenium IDE:
fireEvent targetID blur
Firefox has a bug which prevents some events from being executed while the browser window is out of focus. This could be an issue when you're running your automation tests - which might be typing even if the window is out of focus.
To fix this issue I triggered the change event "manually", injecting javascript into my tests.:
//suppose "element" is an input field
element.sendKeys("value");
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("$(arguments[0]).change();", element);
As you might have noticed, I'm using jQuery to trigger the change event. If you're not using jQuery on your app, you can check here how to trigger it using vanilla javascript.
Hope that helps somebody.
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