Title: Nachricht

When adding dynamic content to a table what I have had to do is something like:

#Load the contents of the table and its objects into the table variable

      table = $ie.table(:index, 2)

      table[3][2].click

     

      $ie.text_field(:name, ' ctl00$pageBody$FavouriteArtistsTextBox ').set("Some text you add")    

      $ie.button("ctl00$pageBody$AddArtistButton ").click

 

#This will reload the just entered dynamic content so you can search it.

      table = $ie.table(:index, 2)

      sList = table[3][2]. select_list(:id,  "ctl00_pageBody_FavouriteArtistsListBox").getAllContents

 

      for myList in sList

next if myList =~ /Some text you add/

puts “Item found in list”

      end

 

Hope this helps,

 

--Mark

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Beaton, Malcolm
Sent: Friday, March 03, 2006 1:45 AM
To: [email protected]
Subject: Extracting contents of a list box in a table

 

OK Firstly apologies if this has a really obvious answer that I should have known but it has stumped me and I cant find any really good resources for tables handling (surprisingly)

I have this on a page (see HTML at the bottom) and this table is table[2]. The top row has a box to enter text into (which I can do) and pressing add adds them to the list box at the bottom. I want to automate this and obviously I need to check the bottom box has the artists I added. But I cant seem to hit the table?

I have tried

ie.form( :name, "aspnetForm").select_list( :id, "ctl00_pageBody_FavouriteArtistsListBox").getAllContents

ie.table(:index, 2).select_list(:id,  "ctl00_pageBody_FavouriteArtistsListBox").getAllContents

And a few other things but I cant get the content back out of it. All it tells me is this is an undefined method for #<Watir::Table:(some crap)>

            <table>
                <tr>
                    <td class="FieldLabel" style="color:Black;">Favourite artists:</td>
                    <td class="Field">
                   
                        <span id="ctl00_pageBody_FavouriteArtistsTextBox_RequiredFieldValidator" style="color:Red;display:none;">Please enter an artist</span>
                   
                        <input name="ctl00$pageBody$FavouriteArtistsTextBox" type="text" id="ctl00_pageBody_FavouriteArtistsTextBox" style="width:200px;" />                                                               
                    </td>
                    <td>
                        <input type="image" name="ctl00$pageBody$AddArtistButton" id="ctl00_pageBody_AddArtistButton" class="Rollover" src="" alt="Add" WebForm_PostBackOptions(&quot;ctl00$pageBody$AddArtistButton&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" style="border-width:0px;" />
                    </td>
                </tr>
                <tr>
                    <td colspan="3"></td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <select size="4" name="ctl00$pageBody$FavouriteArtistsListBox" id="ctl00_pageBody_FavouriteArtistsListBox" style="width:200;">
 <option value="246880">Prince</option>
 <option value="252643">Madonna</option>

</select> 

 

Thanks in advance

Malcolm

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

Reply via email to