Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

should fill_in use send_keys internally? #523

Open
botandrose opened this issue Aug 12, 2014 · 5 comments
Open

should fill_in use send_keys internally? #523

botandrose opened this issue Aug 12, 2014 · 5 comments

Comments

@botandrose
Copy link
Contributor

Heya, just ran into an issue where I was trying to test an autocomplete field, and had to drop down from fill_in to native.send_keys in order for the keyboard events to trigger the autocomplete. This raises the question: any reason not to use send_keys internally for fill_in? I'd be happy to make a PR for this!

@yaauie
Copy link
Contributor

yaauie commented Aug 12, 2014

This can be a bit of a minefield, but you're welcome to tackle it; If my memory serves me right, I believe that fill_in currently would be analogous to a focus followed by a paste, while I believe native.send_keys maps over each character and attempts to mimic the pressing of the key or keys needed to make that character, which can have some complicated locale-based edge-cases (e.g., sending an @ character is SHIFT+2 on US-keyboard, but ALT+0 on a french keyboard. I am unsure what the extent of this mapping is – if it is only a few magic characters, or all non-ASCII that get this treatment.

A patch would be welcome, but it would need fairly extensive testing around special characters.

@aprescott
Copy link
Contributor

I think I would expect fill_in to actually have locale dependencies, and simulate real user keyboard interaction. Is there a reason to not go down that road?

@yaauie
Copy link
Contributor

yaauie commented Aug 12, 2014

My only reason for not going down that path myself is that I haven't needed it. If you have a need and can solve it with a patch, I'll gladly help shepherd it to merging.

@botandrose
Copy link
Contributor Author

Great! I'll begin.

@route
Copy link
Contributor

route commented Aug 12, 2014

As I remember Jon has already tried to replace this logic with send_keys but faced an issue. There were buggy release and then he switched logic back. You can find out more from git log indeed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants