testing - Selecting a date value from a dynamically generated listbox -


I have a list list whose values ​​are dynamically generated. The I list contains months and years and when Appears to appear

  & lt; Select name = "arr_dtm_mon_year" tabindex = "150" square = "input" & gt; & Lt; Option value = "" & gt; & Lt; / Options & gt; & Lt; Option value = "NOV ​​09" & gt; November 09, & lt; / Options & gt; & Lt; Option value = "DEC 09" & gt; December 09 & lt; / Options & gt; & Lt; Option value = "Jan 10" & gt; January 10 & lt; / Options & gt; & Lt; Option value = "fbi 10" & gt; February 10 & lt; / Options & gt; & Lt; Option value = "March 10" & gt; March 10 & lt; / Options & gt; & Lt; Option value = "apr 10" & gt; April 10 & lt; / Options & gt; & Lt; Option value = "May 10" & gt; May 10 & lt; / Options & gt; & Lt; Option value = "June 10" selected & gt; June 10 & lt; / Options & gt; & Lt; Option value = "Jul 10" & gt; July 10 & lt; / Options & gt; & Lt; Option value = "Aug 10" & gt; August 10 & lt; / Options & gt; & Lt; Option value = "SEP10" & gt; September 10 & lt; / Options & gt; & Lt; Option value = "Oct 10" & gt; October 10 & lt; / Options & gt; & Lt; / Select & gt;  

The element that is selected by default in the list box is the current month. When I use Selenium IDE to select from this listbox, it works fine. I use the commands given here to select from the list.

& lt; Tr & gt; & Lt; TD & gt; Select & lt; / TD & gt; & Lt; TD & gt; Arr_dtm_mon_year & lt; / TD & gt; & Lt; Td> Label = 10 oct October & lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Select & lt; / TD & gt; & Lt; TD & gt; Arr_dtm_mon_year & lt; / TD & gt; & Lt; Td> Label = 10 May & lt; / Td> & Lt; / TR & gt;

Now my problem is that the value in the list box is dynamically generated. In the above example, I have opted for "May 10", the value generated is a list of the last six months and the list of all future six months.

It basically means that if I run again from a 6 month trial then "May 10" will not be available from the list. Is it possible to choose the value dynamically? For example, I can calculate the current month and select the value that is the current month + 1 (i.e. next month). And also what I set next month, after that I can build the value to choose.

Any help would be greatly appreciated.

You can select items based on your status (zero indexed) in the list. Select the following third item:

  & lt; Tr & gt; & Lt; TD & gt; Select & lt; / TD & gt; & Lt; TD & gt; Name = arr_dtm_mon_year & lt; / TD & gt; & Lt; TD & gt; Index = 2 & lt; / TD & gt; & Lt; / TR & gt;  

If you want to know the label for the price that you want to use to select your selection (or label it as your original code), then you can use the following :

  & lt; TR & gt; & Lt; TD & gt; StoreText & lt; / TD & gt; & Lt; Td> Css = select [name = arr_dtm_mon_year] option: nth-child (3) & lt; / Td> & Lt; TD & gt; Label & lt; / TD & gt; & Lt; / TR & gt;  

You can use it as follows:

  & lt; Tr & gt; & Lt; TD & gt; Select & lt; / TD & gt; & Lt; TD & gt; Name = arr_dtm_mon_year & lt; / TD & gt; & Lt; TD & gt; Label = $ {label} & lt; / TD & gt; & Lt; / TR & gt;  

Hope that makes sense! :)


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -