0
votes

Does anybody know how to simulate typing on Chromium? I want to simulate real typing and I successfully used combination of keydown+keypress+keyup on firefox. However, this approach does not work on Chrome. I tried key{down|press|up}native but that does not help, either. Using type command does not work, because it is not simulating the real typing, it is just setting the input element's value. I know there is a bug in Chromium where one is not able to dispatch key events successfully, but I wasn't sure does Selenium works on javascript level, or maybe on window level. Is this an obstacle I can't get over?

Thanks!

1
did you also try typeKeys and fireEvent? - Ashkan Aryan
I tried typeKeys and it works on Firefox, but not Chromium, Opera and IE9. Don't know how to use fire event with keypress, because I need to pass keycode, too? - bellpeace
It works on Opera 9, but I am not able to run it on Opera 11.5. Chrome and Safari (Webkit based browsers) trigger the event, but event parameters are 0, so there is no enough data to work with. Firefox works like a charm. - bellpeace
I am using jQUery, can that be an issue? - bellpeace

1 Answers

0
votes

I don't know how you are using Selenium but if you are using it through Selenium RC API you can use normal type (which copies the string into the field). After that try using something like fireEvent("yourstringlcoator", "KeyUp"). This has worked for me in a situation when I wanted the keyUP event triggered (this was with jQuery datatables actually).