开发者

checking if all elements in a drop down menu are present with selenium testing using ruby?

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(",")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜