Module: BrowserShooter::Commands::Basic

Defined in:
lib/browser_shooter/commands/basics.rb

Instance Method Summary collapse

Instance Method Details

#click(css_selector) ⇒ Object



12
13
14
# File 'lib/browser_shooter/commands/basics.rb', line 12

def click( css_selector )
  driver.find_element( "css", css_selector ).click
end

#pause(seconds) ⇒ Object



20
21
22
23
24
25
# File 'lib/browser_shooter/commands/basics.rb', line 20

def pause( seconds )
  BrowserShooter::Logger.log "pausing #{seconds} seconds"
  Kernel.sleep seconds

  return "#{seconds} seconds later..."
end

#type(css_selector, text) ⇒ Object



16
17
18
# File 'lib/browser_shooter/commands/basics.rb', line 16

def type( css_selector, text )
  driver.find_element( "css", css_selector ).send_keys( text )
end

#wait_for_element(css_selector, timeout) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/browser_shooter/commands/basics.rb', line 4

def wait_for_element( css_selector, timeout )
  wait = Selenium::WebDriver::Wait.new( :timeout => timeout )

  wait.until do
    driver.find_element( "css", css_selector )
  end
end