Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9184745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:07:39+00:00 2026-06-17T19:07:39+00:00

I want to select value from drop down box using Ruby with watir-webdriver. Here

  • 0

I want to select value from drop down box using Ruby with watir-webdriver. Here is the command

browser.select_list(:id, "ctl00_SampleContent_ComboBox1_ComboBox1_OptionList").select("Whiskey")

and i got an error
unable to locate element, using {:id=>”ctl00_SampleContent_ComboBox1_ComboBox1_OptionList”, :tag_name=>”select”}

Any ideas what is wrong?
Here is full code:

# 1.Open http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/Default.aspx
  #browser = Watir::Browser.new
  #browser = Watir::Browser.new :ie
  profile = Selenium::WebDriver::Firefox::Profile.from_name 'WatirWebDriver'
  #profile.add_extension 'autoauth-2.1-fx+fn.xpi'
  browser = Watir::Browser.new :firefox, :profile => profile
  browser.goto 'http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/Default.aspx'

  #2.Click ComboBox link on the left pane of the page
  browser.a(:id, 'ctl00_SamplesLinks_ctl15_SamplesLink').click

  #3.Verify that http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/ComboBox/ComboBox.aspx URL opened
  if browser.url.eql? "http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/ComboBox/ComboBox.aspx"
    puts "Error loading page \"http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/ComboBox/ComboBox.aspx URL opened\""
    return false
  end

  #4.Select “Whiskey” in the combo-box
  #browser.select_list(:id, 'ctl00_SampleContent_ComboBox1_ComboBox1_OptionList').select_value('Whiskey')
  puts "!!!"
  browser.select_list(:id, "ctl00_SampleContent_ComboBox1_ComboBox1_OptionList").when_present.select("Whiskey")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:07:41+00:00Added an answer on June 17, 2026 at 7:07 pm

    This does the job:

    require "watir-webdriver"
    browser = Watir::Browser.new
    browser.goto "http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ComboBox/ComboBox.aspx"
    browser.button(id: "ctl00_SampleContent_ComboBox1_ComboBox1_Button").click
    browser.ul(:id, "ctl00_SampleContent_ComboBox1_ComboBox1_OptionList").li(text: "Whiskey").click
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to the user to select an option from a drop down box
When a certain value from a drop-down box is selected, I want another section
I want to assign a value from a select box to an input field
I want to have a drop down menu where a user can select from
Here is my run-of-the-mill drop down: <select name=> <option value=>--Select One--</option> <option value=textarea>Text Area</option>
When the user selects from a drop down box, I want to change the
when i select a type from a drop down box the form fields are
How can I alert the value selected by user from a select drop down
I want to select value from select list in RSpec . For example i
With Perl's WWW::Mechanize module, I want to select a random value from a select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.