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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:22:39+00:00 2026-05-15T10:22:39+00:00

I have a listbox whose values are generated dynamically. The list box contains months

  • 0

I have a listbox whose values are generated dynamically. The list box contains months and years and when generated looks like this.

<select name="arr_dtm_mon_year" tabindex="150" class="input">
    <option value=""></option>
    <option value="NOV 09">Nov 09</option>
    <option value="DEC 09">Dec 09</option>
    <option value="JAN 10">Jan 10</option>
    <option value="FEB 10">Feb 10</option>
    <option value="MAR 10">Mar 10</option>
    <option value="APR 10">Apr 10</option>
    <option value="MAY 10">May 10</option>
    <option value="JUN 10" selected>Jun 10</option>
    <option value="JUL 10">Jul 10</option>
    <option value="AUG 10">Aug 10</option>
    <option value="SEP 10">Sep 10</option>
    <option value="OCT 10">Oct 10</option>
</select> 

The element in the listbox that is by default selected is the current month. When i use selenium IDE to select from this listbox it works fine. Here are example commands i use to select from the listbox.

<tr>
    <td>select</td>
    <td>arr_dtm_mon_year</td>
    <td>label=Oct 10</td>
</tr>
<tr>
    <td>select</td>
    <td>arr_dtm_mon_year</td>
    <td>label=May 10</td>
</tr>

Now the problem i have is the values in the listbox is dynamically generated. In the above example i selected the option for “May 10”. The values that are generated is a list of all previous six months and a list of all future six months.

This basically means that if i rerun the test 6 months from now “May 10” will not be available from the list. Is it possible to select the value dynamically. For example can i first calculate the current month and select the value with that is current month + 1 (i.e. next month). And also how can i build the value to be selected after i have determined what the next month is.

Any help will be greatly appreciated.

  • 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-05-15T10:22:39+00:00Added an answer on May 15, 2026 at 10:22 am

    You can select the item based on it’s position in the list (zero indexed). The following would select the third item:

    <tr>
        <td>select</td>
        <td>name=arr_dtm_mon_year</td>
        <td>index=2</td>
    </tr>
    

    If you also want to know the label for the value that your selecting (or want to use it to select by label as your original code) you can use the following:

    <tr>
        <td>storeText</td>
        <td>css=select[name=arr_dtm_mon_year] option:nth-child(3)</td>
        <td>label</td>
    </tr>
    

    You can then use it as follows:

    <tr>
        <td>select</td>
        <td>name=arr_dtm_mon_year</td>
        <td>label=${label}</td>
    </tr>
    

    Hope that makes sense! 🙂

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

Sidebar

Related Questions

I have a ListBox whose ItemsSource is bound to a list of objects. The
I have a ListBox whose ItemsSource is databound to a list of ints. I'd
I have listbox like this: <ListBox Height=589 HorizontalAlignment=Left Name=AllNotesListBox VerticalAlignment=Top Width=460 SelectionChanged=AllNotesListBox_SelectionChanged> <ListBox.ItemTemplate> <DataTemplate>
I have a listbox whose listboxitem contains, among other things, a button, as follows:
I have an ASP.NET page with a listbox whose selection mode is set to
I have a ListBox that has a style defined for ListBoxItems. Inside this style,
I have a listbox, which is defined like so: <ListBox ItemsSource={Binding Source={x:Static local:ResourceCollection.resourceList}} Height=143
I have a ListBox whose ItemsPanel I have replaces with a WrapPanel. The WrapPanel
I have a listbox bound to a view model observable collection: This works fine,
I have an app that has a ListBox of ListBoxes. I would like to

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.