Skip to content

Instantly share code, notes, and snippets.

Created December 26, 2012 18:58
Show Gist options
  • Save anonymous/4382236 to your computer and use it in GitHub Desktop.
Save anonymous/4382236 to your computer and use it in GitHub Desktop.
def set_pixel_type(type)
ddown_waiter = Selenium::WebDriver::Wait.new(:timeout => 3)
begin
begin
ddown_waiter.until{ $browser.find_element(:css, ".info") }
rescue
Sel_Utils::Sel_Utils.ClickObject("css", ".dropdown-pixel-type .button")
retry
end
ddown_values = $browser.find_elements(:css, ".item.clearfix .info")
ddown_values.each_with_index{|value, i|
if value.text.include?(type)
ddown_values[i].click
return
end
}
if($browser.find_element(:css, ".n-dropdown-input").attribute("value") != "Choose a type")
retry #retry from the begin block on line 4
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment