Open lukeis opened 8 years ago
Reported by a.u.savchuk
on 2013-07-20 08:29:37
Update: I upgraded to the latest ChromeDrivers.
I'm running ChromeDriver v2.1 (v2.1.210398) on OSX 10.7.5 and the test case still fails.
I'm running ChromeDriver v2.1.210652 on Windows 7 and it passes.
Firefox fails on both OSX and Windows. Internet Explorer fails as well. Happy to provide
versioning information and logs for any combination requested.
Thanks.
Reported by byronner
on 2013-07-25 22:47:26
While I'm trying to reproduce the issue I want to say that your scenario is overcomplicated
:)
browser = Selenium::WebDriver.for :firefox
begin
browser.get "file://#{path}"
editable = browser.find_element :id, "editable"
editable.send_keys "abc"
# Copy
editable.send_keys(:control, "a")
editable.send_keys(:control, "c")
# Paste
editable.send_keys(:control, "v", "v", "v")
ensure
#browser.quit
File.delete path
end
Note that on Windows you have to use :control instead of :command
I checked this code works in Chrome and Firefox. IE can't work with file:// URLs, deploy
the page to a server and I'm sure IE will work too.
Reported by barancev
on 2013-07-30 20:58:06
Thank you for looking into this issue; I really appreciate you taking the time to help
out.
Is there a specific reason that you've implemented the paste as editable.send_keys(:control,
"v", "v", "v")? In my view, this changes the test case. I do not wish to paste the
text three times, overwriting the selection the first time. I simply want to append
the pasted text once, which is why in my original test case I remove the highlighting
first. Making that modification to your code yields the following paste command:
editable.send_keys :arrow_right # Remove highlighting
editable.send_keys(:control, "v") # Paste
Regardless of whether I use this implementation or editable.send_keys(:control, "v",
"v", "v"), I'm seeing buggy behavior. Here's the results I get with both implementations:
__OSX 10.7.5__
Firefox 22:
editable.send_keys :arrow_right
editable.send_keys(:command, "v")
Expected text: "abcabc"
Actual text: "abc abc "
editable.send_keys(:command, "v", "v", "v")
Expected text: "abcabcabc"
Actual text: "abc abc abc "
Chrome 28:
editable.send_keys :arrow_right
editable.send_keys(:command, "v")
The text is not pasted.
editable.send_keys(:command, "v", "v", "v")
The text is not pasted.
__Windows 7__
Chrome 28:
Works as expected
Firefox 22:
editable.send_keys :arrow_right
editable.send_keys(:control, "v")
Expected: "abcabc"
Actual: "abc abc "
editable.send_keys(:control, "v", "v", "v")
Expected text: "abcabcabc"
Actual text: "abc abc abc "
Internet Explorer:
Works as expected with your simplified code. With my original code it does not. I've
found that file:// URL's work fine with IE, though that is a limitation in Safari.
I think the difference must be due to me using the ActionBuilder api explicitly and
your test code here using it implicitly via send_keys. I'll look into that more; it
may be worthy of its own bug.
Thanks again for looking at this. Let me know if you have any questions about this
reply, or if I can help debug/provide any further info.
Reported by byronner
on 2013-07-30 22:08:45
Yes, my bad, "paste three times" was my modification that allowed me to see more obviousely
that pasting works.
Reported by barancev
on 2013-07-30 22:25:34
I'm a bit surprised that chording keys in the way barancev does here actually works.
I would expect to have to do:
element.send_keys([:command, 'v'])
in order to get the keys pressed at the same time.
Reported by jari.bakken
on 2014-08-13 09:29:36
Reported by luke.semerau
on 2015-09-17 17:45:54
Originally reported on Google Code with ID 5946
Reported by
byronner
on 2013-07-18 03:34:59