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 7909267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:20:25+00:00 2026-06-03T12:20:25+00:00

I’ve re-written this question so that it makes more sense. Is there a way

  • 0

I’ve re-written this question so that it makes more sense.

Is there a way to enable Ruby to listen for a newly created (dynamic) select-list on a webpage and save that list into an array?

This would be the scenario:

  1. User Selects a Branch number, 02
  2. User selects a person type, missionary
  3. A new dynamic select list of missionary names is generated

Ruby would need to capture the dynamically created list of names and save them into an array. This is the code thus far:

missionaries = Array.new

browser.select_list(:id,'branch_select').select_value('02')
browser.select_list(:id,'user_type_select').select_value('1') # 1 = Missionary
browser.select_list(:index,2).click # <-This is the dynamically created list
missionaries = browser.select_list(:index,2) # <-This is just a guess, doesn't work
puts "Missionary List: " + missionaires.to_s # <-Prints to verify list saved

What this actually prints to screen is this:

 Missionary List: #<Watir::Select:0x147e54e>
  • 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-03T12:20:27+00:00Added an answer on June 3, 2026 at 12:20 pm

    OK, I’ve figured it out. The list was being dynamically populated by a JSON call. What I’ve had to do is first figure out what happens when the second list item is selected (in this case, missionaries). As soon as that was selected, a GET request was sent, then a JSON string was received.

    The string had to be captured by Ruby using the open-uri gem/library. Then parsed using the json gem. After that I used regex to count the amount of times that a new id was found. Here’s the new code:

    browser.select_list(:id,'branch_select').select_value('01')
    browser.select_list(:id,'user_type_select').select_value('1') 
    browser.select_list(:index,2).click
    json = open("http://10.5.26.9:8080/MissionaryLetters/getUsers?branchID=01&userTypeID=1").read
    json = JSON.parse(json)
    puts json
    missionaries = json.to_s.scan(/id\d/).length
    puts missionaries
    

    This would print the amount of missionaries found in the Branch, in this case 16.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters

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.