tags:

views:

30

answers:

1

Hi, I am having trouble selecting this with watir. I'm trying xpath and is able to try something like this

browser.element_by_xpath("select/option[2]").text

and it will return the text. but how would i select the text in the dropdown. Thanks

 <select>
    <option value="">--Select One--</option>
    <option value="test">NAME1</option>
    <option value="test2">NAME2</option>
    </select>
+1  A: 

Found out how to do it myself. Here is what i did for reference.

      browser.select_list(:xpath, "select/option[2]").set(browser.select_list(:xpath, "select/option[2]").getAllContents[2])
AJ