@@ -24,7 +24,31 @@ module Actions
24
24
def click_link_or_button ( locator = nil , **options )
25
25
find ( :link_or_button , locator , options ) . click
26
26
end
27
- alias_method :click_on , :click_link_or_button
27
+
28
+ ##
29
+ #
30
+ # Finds an element and clicks on it
31
+ #
32
+ # By default this is an alias of {Capybara::Node::Actions#click_llink_or_button}
33
+ # @overload click_on([locator], **options)
34
+ # By default this is an alias of {Capybara::Node::Actions#click_link_or_button}
35
+ # @macro waiting_behavior
36
+ # @param [String] locator See {Capybara::Node::Actions#click_button} and {Capybara::Node::Actions#click_link}
37
+ #
38
+ # @overload click_on(selector, [locator], **options)
39
+ # @macro waiting_behavior
40
+ # @param [Symbol] symbol A registered selector type (:css, :xpath, :element, ...) See {Capybara::Selector} for built-in selectors.
41
+ # @param [String] locator See {Capybara::Selector} for locator specifics
42
+ #
43
+ # @return [Capybara::Node::Element] The element clicked
44
+ #
45
+ def click_on ( *args , **options )
46
+ if args [ 0 ] . is_a? ( Symbol )
47
+ find ( *args , **options ) . click
48
+ else
49
+ click_link_or_button ( *args , **options )
50
+ end
51
+ end
28
52
29
53
##
30
54
#
0 commit comments