Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save prashanth-sams/1a5528c69796e57fc7902308182851da to your computer and use it in GitHub Desktop.
Save prashanth-sams/1a5528c69796e57fc7902308182851da 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