Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix emoji sending in headless chrome #2409

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 12 additions & 6 deletions lib/capybara/selenium/nodes/chrome_node.rb
Expand Up @@ -78,12 +78,18 @@ def send_keys(*args)
.each do |contains_emoji, inputs|
if contains_emoji
inputs.join.grapheme_clusters.chunk { |gc| gc.match?(/\p{Emoji Presentation}/) }
.each do |emoji, clusters|
if emoji
driver.send(:execute_cdp, 'Input.insertText', text: clusters.join)
else
super(clusters.join)
end
.each do |_emoji, clusters|
# For non-headless we can send non-emoji normally and then send emoji via CDP
# thereby getting key events and emoji. Unfortunately that doesn't work for
# headless chrome currently so just send via cdp
driver.send(:execute_cdp, 'Input.insertText', text: clusters.join)

# .each do |emoji, clusters|
# if emoji
# driver.send(:execute_cdp, 'Input.insertText', text: clusters.join)
# else
# super(clusters.join)
# end
end
else
super(*inputs)
Expand Down