Module: Rufus

Included in:
Accessors::View
Defined in:
lib/rufus.rb,
lib/rufus/driver.rb,
lib/rufus/navigation.rb,
lib/rufus/accessors/view.rb,
lib/rufus/accessors/table.rb,
lib/rufus/drivers/iOS_device.rb,
lib/rufus/accessors/accessors.rb,
lib/rufus/drivers/iOS_simulator.rb

Defined Under Namespace

Modules: Accessors, Drivers, Navigation Classes: Driver

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(cls) ⇒ Object



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

def self.included(cls)
  cls.extend Rufus::Accessors
end

Instance Method Details

#click(locator) ⇒ Object



61
62
63
# File 'lib/rufus.rb', line 61

def click(locator)
  selenium.find(locator).click
end

#displayed_after_wait?(view, timeout = 5) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
30
# File 'lib/rufus.rb', line 22

def displayed_after_wait?(view, timeout = 5)
  wait = Selenium::WebDriver::Wait.new :timeout => timeout
  begin
    wait.until{view.displayed?}
  rescue Selenium::WebDriver::Error::TimeOutError
    return false
  end
  true
end

#displayed_hash_after_wait?(locator, timeout = 5) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
55
# File 'lib/rufus.rb', line 52

def displayed_hash_after_wait?(locator, timeout = 5)
  view = Rufus::Accessors::View.new locator
  displayed_after_wait? view, timeout
end

#elements_of_type(type) ⇒ Object



69
70
71
# File 'lib/rufus.rb', line 69

def elements_of_type(type)
  selenium.elements_by_tag(type)
end

#enabled_after_wait?(view, timeout = 5) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
37
38
39
40
# File 'lib/rufus.rb', line 32

def enabled_after_wait?(view, timeout = 5)
  wait = Selenium::WebDriver::Wait.new :timeout => timeout
  begin
    wait.until{view.enabled?}
  rescue Selenium::WebDriver::Error::TimeOutError
    return false
  end
  true
end

#enabled_hash_after_wait?(locator, timeout = 5) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
45
# File 'lib/rufus.rb', line 42

def enabled_hash_after_wait?(locator, timeout = 5)
  element = find locator
  enabled_after_wait? element, timeout
end

#exists_after_wait?(view, timeout = 5) ⇒ Boolean

Returns:

  • (Boolean)


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

def exists_after_wait?(view, timeout = 5)
  wait = Selenium::WebDriver::Wait.new :timeout => timeout
  begin
    wait.until{view.exists?}
  rescue Selenium::WebDriver::Error::TimeOutError
    return false
  end
  true
end

#exists_hash_after_wait?(locator, timeout = 5) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
50
# File 'lib/rufus.rb', line 47

def exists_hash_after_wait?(locator, timeout = 5)
  view = Rufus::Accessors::View.new locator
  exists_after_wait? view, timeout
end

#find(locator) ⇒ Object



57
58
59
# File 'lib/rufus.rb', line 57

def find(locator)
  selenium.find(locator)
end

#page_sourceObject



65
66
67
# File 'lib/rufus.rb', line 65

def page_source
  selenium.page_source
end

#scroll_to(locator) ⇒ Object



73
74
75
# File 'lib/rufus.rb', line 73

def scroll_to(locator)
  selenium.scroll_to(locator)
end