mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Implement Node#send_keys support for selenium
This commit is contained in:
parent
8a7a1dda1d
commit
a84d724d16
3 changed files with 81 additions and 0 deletions
|
@ -50,6 +50,10 @@ module Capybara
|
|||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def send_keys(*args)
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def hover
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
|
|
@ -148,6 +148,79 @@ module Capybara
|
|||
def double_click
|
||||
synchronize { base.double_click }
|
||||
end
|
||||
|
||||
##
|
||||
#
|
||||
# Send Keystrokes to the Element
|
||||
#
|
||||
# @param [String, Symbol, Array]
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# element.send_keys "foo" #=> value: 'foo'
|
||||
# element.send_keys "tet", :left, "s" #=> value: 'test'
|
||||
# element.send_keys [:control, 'a'], :space #=> value: ' '
|
||||
#
|
||||
# Symbols supported for keys
|
||||
# :cancel
|
||||
# :help
|
||||
# :backspace
|
||||
# :tab
|
||||
# :clear
|
||||
# :return
|
||||
# :enter
|
||||
# :shift
|
||||
# :control
|
||||
# :alt
|
||||
# :pause
|
||||
# :escape
|
||||
# :space
|
||||
# :page_up
|
||||
# :page_down
|
||||
# :end
|
||||
# :home
|
||||
# :left
|
||||
# :up
|
||||
# :right
|
||||
# :down
|
||||
# :insert
|
||||
# :delete
|
||||
# :semicolon
|
||||
# :equals
|
||||
# :numpad0
|
||||
# :numpad1
|
||||
# :numpad2
|
||||
# :numpad3
|
||||
# :numpad4
|
||||
# :numpad5
|
||||
# :numpad6
|
||||
# :numpad7
|
||||
# :numpad8
|
||||
# :numpad9
|
||||
# :multiply - numeric keypad *
|
||||
# :add - numeric keypad +
|
||||
# :separator - numeric keypad 'separator' key ??
|
||||
# :subtract - numeric keypad -
|
||||
# :decimal - numeric keypad .
|
||||
# :divide - numeric keypad /
|
||||
# :f1
|
||||
# :f2
|
||||
# :f3
|
||||
# :f4
|
||||
# :f5
|
||||
# :f6
|
||||
# :f7
|
||||
# :f8
|
||||
# :f9
|
||||
# :f10
|
||||
# :f11
|
||||
# :f12
|
||||
# :meta
|
||||
# :command - alias of :meta
|
||||
#
|
||||
def send_keys(*args)
|
||||
synchronize { base.send_keys(*args) }
|
||||
end
|
||||
|
||||
##
|
||||
#
|
||||
|
|
|
@ -80,6 +80,10 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
|||
def double_click
|
||||
driver.browser.action.double_click(native).perform
|
||||
end
|
||||
|
||||
def send_keys(*args)
|
||||
native.send_keys(*args)
|
||||
end
|
||||
|
||||
def hover
|
||||
driver.browser.action.move_to(native).perform
|
||||
|
|
Loading…
Reference in a new issue