There's a command you can use to return the entire contents of a select box as an array. I don't have access to the API right now but I think it's called ie.select_list.selectall or something similar.

Once you have the contents of the selectbox as an array, you can get the length of the array and set a loop to iterate the same amount of times. Each time you loop you just get the next value of the array based on it's index and use the value to select an item from the select box.

Sorry I can't give you any example code but the approach should work.

On 28/09/05, Cain, Mark <[EMAIL PROTECTED] > wrote:

I had a similar problem, a set of dropdowns whose values are determined by whatever is previously selected in the preceding dropdown.  Mine happened to be in a new window that was popped up but the principle is the same.  What I needed to do was look at the 'View Source' for the page and determine what the potential values were for a given selection, and then code my example accordingly. 

E.g. For dropdown A, if I select A1 then the possible options fro dropdown B are B1, B2, B3, etc.  And if B2 is selected from dropdown B then the possible values for dropdown C are C4, C5, C7, etc. and so on. 

 

Here is the code I used...

 

cw = IE.attach(:title, /PER Causal Code Management/i)

      cw.selectBox(:index, 1).select(/A1/)

      cw.selectBox(:index, 3).select(/B1/)

      cw.selectBox(:index, 12).select(/C01/)

      cw.button(:caption,"Add Causal Codes").click

      cw.button("Close Window").click

 

A matrix for this would be pretty ugly for more than 3 dropdown with many values each, but it might save some time in the long run to do it.

It would look something like this:

                 

A1

 

B1

 

C1

C4

C5

B3

 

C2

C7

B5

 

C3

C6

C8

A2

 

B2

 

C9

C10

B4

 

C11

C12

 

 

Hope this helps answer your question.

 

--Mark

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Amita Shetty
Sent: Tuesday, September 27, 2005 10:37 PM
To: [email protected]
Subject: [Wtr-general] Is there a way to select items in the select listbased on their position?

 

Hi,

    Is there a way to select  items in the select list based on their position?

 

one way is:

 ie.select_list(:name,"NAME").select_value(/2/)

Since the items in the select list are added dynamically based on the selection in the previous Select list, its   value is not known priorly.So I am not able to do that way..

 

 I want to write a test case such that in the first iteration, first item in the list is selected, in the second iteration second item is selected and so on.

 

 

 

Thanks in advance,

Amitha..

 

 

 

_______________________________________________

Wtr-general mailing list

[email protected]

http://rubyforge.org/mailman/listinfo/wtr-general


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general



_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to