Class: SK::Clickable

Inherits:
Element show all
Defined in:
lib/clickable.rb

Direct Known Subclasses

Button, Link

Instance Attribute Summary

Attributes inherited from Element

#el, #locator

Instance Method Summary collapse

Methods inherited from Element

#children, #displayed?, #enabled?, #exists?, #find, #find_child_el, #html, #parent_el, #search, #text, #to_s

Constructor Details

#initialize(locator, delay: 0) ⇒ Clickable

a clickable element can be created with a custom delay so that the tester does not have to set the delay at every calling point… just once at the creation oint



7
8
9
10
# File 'lib/clickable.rb', line 7

def initialize(locator,delay: 0)
  super(locator) # creates the el and locator
  @delay = delay
end

Instance Method Details

#click(delay = @delay) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/clickable.rb', line 12

def click(delay = @delay)
  if self.el
    # SK::Trace.trace "SK::Clickable.click #{self.locator} #{self.el}"
    self.el.click
    sleep delay
  else
    SK::Trace.error "SK::Clickable.click: element not initialized for #{locator}"
  end
end