
Untitled
By: a guest on
May 25th, 2012 | syntax:
None | size: 1.32 KB | hits: 9 | expires: Never
def select_value(type, choice)
b_clicked = false
if !is_ddown_open("css", ".item.loading-items")
Sel_Utils::Sel_Utils.ClickObject("css", ".#{type}-tokenfield>div>div>input")
end
begin
$waiter.until{ !$browser.find_element(:css, ".item.loading-items") }
rescue
#do nothing
end
options = $browser.find_elements(:css, '.item.item-existing')
options.each{|option|
if(option.text == choice)
option.click
b_clicked = true
end
}
if b_clicked != true
Sel_Utils::Sel_Utils.Send_Keys("css", ".#{type}-tokenfield>div>div>input", choice + "\xEE\x80\x87")
end
verify_value_selection(type, choice)
end
def is_ddown_open(type, element_locator)
begin
$browser.find_element(type.to_sym, element_locator)
rescue
return false
end
return true
end
def verify_value_selection(type, choice)
text_identified = 0
labels = $browser.find_elements(:css, ".#{type}-tokenfield>.tokenfield-contents>.n-token")
labels.each{|label|
if (label.text.include?(choice))
text_identified+=1
end
}
if text_identified == 1
$Sel_log.result("TRUE", "Choice selected for option #{type}")
else
$Sel_log.result("FALSE", "Choice selected for option #{type}", "'#{choice}' was not found")
end
end