Skip to content

Instantly share code, notes, and snippets.

@richdownie
Created June 11, 2013 17:59
Show Gist options
  • Save richdownie/5759189 to your computer and use it in GitHub Desktop.
Save richdownie/5759189 to your computer and use it in GitHub Desktop.
Given /I click_on "(.*)" "(.*)"/ do |value, type|
steps %Q{
And I wait until "#{value}" "#{type}" renders
}
@driver.find_element(type.to_sym => value).click
end
When /I wait for "(.*)" "(.*)" to render/ do |what, how|
start_time = Time.now.to_i
wait = Selenium::WebDriver::Wait.new(:timeout => 60)
wait.until {
element = @driver.find_element(:xpath, ".//" + how + "[text()='" + what + "']")
element if element.displayed?
}
end_time = Time.now.to_i - start_time
puts (end_time.to_s + " seconds to render " + what.inspect + how.to_sym.inspect)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment