Re: Selecting a value from a dropdown list with Webdriver/Ruby

32 views
Skip to first unread message
Message has been deleted

Larry Brown

unread,
Nov 13, 2014, 6:50:51 PM11/13/14
to seleniu...@googlegroups.com


On Thursday, November 13, 2014 3:46:05 PM UTC-8, Larry Brown wrote:
I have looked through several sources but so far I have not found an answer to my specific issue. Hopefully someone here has an answer.

I am trying to convert functioning Selenium IDE scripts to Webdriver by exporting them using Ruby test/unit. I have a few tests that require the user to select from a dropdown list of 2-3 choices. It apears to execute the command and try to select the correct one from the list, but it ends up selecting the default choice, which is the first one on the list. Here is the code:


    @driver.find_element(:id, "roleDdl").click
    Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, "roleDdl")).select_by(:text, "Seller")
    @driver.find_element(:css, "option[value=\"seller\"]").click
    @driver.find_element(:css, "input.bf-buttonpos").click

It looks for the "role dropdown list"  then it selects the dropdown and looks for "Seller" and it is supposed to select seller from the list and continue on from there. It ends up selecting "Buyer" which is the default,, 

Does anyone have an idea what I am missing in my code?

BTW, I am using Windows 7 and Firefox 33.1 
Reply all
Reply to author
Forward
0 new messages