Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

fix input keypress #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

chenglou
Copy link
Contributor

Please don't merge yet. This only partially fix the problem, more discussion coming up.

**Please don't merge yet**. This only partially fix the problem, more discussion coming up.
@chenglou
Copy link
Contributor Author

yo @petehunt, key input on form elements doesn't actually work lol.

The problem is that faking a click on the input doesn't actually focus it, so subsequent key presses are really sent against nothing. This patch fixes this but actually introduces two problems:

  1. The screen shot when the window is active vs non-active will be different, because only the active window shows the blue hue around focused elements. Simplest way of working around this is to ask the tester to never focus on the browser window during the entire rerun/replay procedure, but this is kind of lame…
  2. This introduces a new bug. Following the sequence click input1 -> press a -> click input2 -> press b will actually result in huxley inputting ab on input1, leaving input2 alone. input2's actually focused briefly thanks to the above patch, but somehow the b key press still ends up on input1. I suspect this has to do with KeyTestStep, will check further. Edit: fixed below.

@chenglou
Copy link
Contributor Author

Alright, the above change fixes the bug 2. There are some KEY_IDs lying around but they don't seem to do anything, so I replaced the ones concerning the patch. Didn't touch the rest.

Still, what about problem 1?

@petehunt
Copy link
Contributor

Are you sure this is an issue? I just added an example which indicates that it works.

@chenglou
Copy link
Contributor Author

That's really weird, I just clone the new version and installed it; doesn't work.
(Selenium 2.35.0)

To sum up, the simulation of the key event can get simpler. We just need to make sure the key is sent to the correct target, which is entirely determined by the previous click step. Check out the two lines of comments.
@chenglou
Copy link
Contributor Author

By the way, if you use ff 23 selenium will crash on < 2.35.0. This has been fixed since.

@ghost ghost added the CLA Signed label Jul 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants