Class: RAutomation::Button

Inherits:
Object
  • Object
show all
Defined in:
lib/rautomation/button.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args)

Allows to execute specific Adapter methods not part of the public API.



43
44
45
# File 'lib/rautomation/button.rb', line 43

def method_missing(name, *args)
  @button.send(name, *args)
end

Instance Method Details

#click {|button| ... }

Performs a click on the button. By default click is considered successful if the button doesn't exist after clicking (e.g. window has closed)

Yields:

  • (button)

    optional block specifying successful clicking condition.

Yield Parameters:

  • button (Button)

    which is being clicked on.

Yield Returns:

  • (Boolean)

    true if clicking on the button is successful, false otherwise.

Raises:



17
18
19
20
21
22
23
24
# File 'lib/rautomation/button.rb', line 17

def click
  wait_until_exists
  if block_given?
    @button.click {yield self}
  else
    @button.click
  end
end

#exists?Boolean Also known as: exist?

Checks if the button exists.

Returns:

  • (Boolean)

    true if button exists, false otherwise.



36
37
38
# File 'lib/rautomation/button.rb', line 36

def exists?
  @button.exists?
end

#valueString

Retrieves the value (text) of the button, usually the visible text.

Returns:

  • (String)

    the value (text) of the button.

Raises:



29
30
31
32
# File 'lib/rautomation/button.rb', line 29

def value
  wait_until_exists
  @button.value
end