I register the following function
JavaScript
x
5
1
//EDIT: updated
2
$("#id").on("change", function() {
3
alert('xxx');
4
});
5
In my IE console I did
JavaScript
1
2
1
document.getElementById('id').onchange();
2
and it says element this does not have property or value.
I am trying to run automation test using
JavaScript
1
2
1
selenium.runScript("document.getElementById('id').onchange();");
2
What are ways around this? In IE I get JavaScript error popping up, thus stopping rest of the test.
Advertisement
Answer
Thanks I found the answer. I had to use
JavaScript
1
2
1
selenium.runScript($("#id").change());
2
even if I had added the missing quote.
If you register listener with on it doesn’t get register by the dom’s onchange event.