HI
how can i check if all elements in an array i created are present in a drop down menu using selenium testing?
i hav开发者_StackOverflowe something like this but dosent seem to work
ANIMALS = ["snake","cat","dog"]
def validate_all_animals_exist(selenium)
ANIMALS.each { |animal| assert selenium.is_element_present(animal), "Expected category [#{animal}] to be present" }
end
thanks in advance
You need to use the verifySelectOptions call
verifySelectOptions(selectLocator, pattern) Generated from getSelectOptions(selectLocator) Arguments:
* selectLocator - an element locator identifying a drop-down menu Returns: an array of all option labels in the specified select drop-down Gets all option labels in the specified select drop-down.
So it would be
assert_equal "123123", page.get_select_options("foo").join(",")
精彩评论