Module: Rufus::Navigation

Includes:
PageNavigation
Defined in:
lib/rufus/navigation.rb

Instance Method Summary collapse

Instance Method Details

#on(cls, timeout = 10, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rufus/navigation.rb', line 7

def on(cls, timeout = 10, &block)
selenium.reset_page_source
screen = cls.new
wait = 0
until wait == timeout  do
  if screen.active?
    block.call screen if block
    return screen
  else
    sleep 1
    wait += 1
  end
end
  raise "Expected #{cls} to be active"
end