Well of course it didn't work against your application.
You asked to click the delete button in a table row which has 3
columns of content.
The above sample had your content in a single rowed table of which
only 1 table in the body of the html code.
Thus    The samples all point to only a single table index=1 and only
one row,   where myTable[1][1] represents Row 1 Column 1 and
myTable[1][3] represents Row 1 Column 3. If your content is in row
seven guess what the index would be.

Your last few posts suggests your very much a novice.
Please try and incorporate some basic programming logic like a loop to
navigate the table structure your interested in.
Also use puts to display log messages so you know what happening in
your code so you can trace back easily.

This is the sample the post checked against it incorporates your
snippet to the group.
You could change the ID of the radio buttons to anything you want and
it would still click the second radio button.

<html>
<head>
</head>
<body>
<form id="t1">
<table>
<tr>
<td>Test</td>
<td>Unpublished</td>
<td class="actions">
<label for="Update">
<input id="act2_165_update" type="radio" value="update" name="act2
[165]"/>
Update
</label>
<label for="del2"> <input id="act2_165_delete" type="radio"
value="delete" name="act2 [165]"/>
Delete
</label>
</td>
</tr>
<tr>
<td width="20%">
<input id="rating[65]" type="checkbox" value="1" name="rating[65]"/>
<a title="Edit Rating" href="/Nikes/ratings/65/edit">
<span class="bold">Ratingsanity1</span>
</a>
</td>
</tr>
</table>
</form>
</body>
</hmtl>

Now lets break down the watir script
First open the browser, make it the top window.
Next for table of index 1 get the text into pollText from row(1)Col
(1)... This would be "Test" from your sample.
Now get the content or row(1)Col(3)... this would have the content of
the radio buttons. Update & Delete
OK I want delete so using (RUBY CLASS STRING) use the rindex (Reverse
Index) and parse out the radio button ID that would equate to delete.
Now that I know the ID substitute that variable into the radio
command... bingo click set flash!

Regards...





On Oct 23, 3:25 am, Amit Kulkarni <amitkkulkarni...@gmail.com> wrote:
> Hi Super,
> I tried with using your code.
> It didnt give me any error but it did not click on the desired button.
> Also it did not print any value.
>
> Also tell me one thing For this we have to run scripts compulsary in I.E or
> is it ok to run in FireFox?
>
> On Thu, Oct 22, 2009 at 8:31 PM, Super Kevy
> <kpe...@scholarshipamerica.org>wrote:
>
>
>
>
>
> > Interesting... I'm assuming table matching is the ticket and dynamic
> > variables being the pain...
> > Try this snippet and modify to suit for page
>
> > require 'watir'
> > require 'watir/ie'
> > require 'watir/dialog'
> > require 'Win32API'
>
> >  ie = Watir::IE.new
> >  sURL='http://www.google.com'
> >  sURL='C:\Documents and Settings\kpetry\Desktop\t.html'
> >  ie.goto(sURL)
> >  ie.bring_to_front()
> >  myTable=ie.table(:index,1)
> >  # loop through the table by indexing the first variable if needed
> > until a match
> >  pollText=myTable[1][1].text.upcase
> >  #Obvious Text matching here.... Then invoke this code stream
> >  theParse=myTable[1][3].attribute_value("InnerHTML")
> >  puts theParse
> >  iStart = theParse.rindex('id=')+3
> >  iEnd = theParse.rindex('type=radio')-1
> >  theId= theParse.slice!(iStart..iEnd).strip!
> >  puts iStart.to_s
> >  puts iEnd.to_s
> >  puts theId+'..'
> >  ie.radio(:id, theId ).flash
> >  ie.radio(:id, theId ).set
>
> > On Oct 22, 8:31 am, Amit Kulkarni <amitkkulkarni...@gmail.com> wrote:
> > > Thanks a lot.But the name "act2[165]" is not going to be same all the
> > time.
> > > I have my poll title as Test.So i want to set my focus on delete radio
> > > button whose title is Test.
> > > Is it possible to do this?
>
> > > This is my html script
> > > <tr>
> > > <td>Test</td>
> > > <td>Unpublished</td>
> > > <td class="actions">
> > > <label for="Update">
> > > <input id="act2_165_update" type="radio" value="update" name="act2
> > > [165]"/>
> > > Update
> > > </label>
> > > <label for="del2">
> > > input id="act2_165_delete" type="radio" value="delete" name="act2
> > > [165]"/>
> > > Delete
> > > </label>
> > > </td>
>
> > > Now here <td>Test</td> is the title of the poll.
> > > So i want to click on delete radio button which has a title named Test
> > :-)
> > > On Thu, Oct 22, 2009 at 6:51 PM, Super Kevy
> > > <kpe...@scholarshipamerica.org>wrote:
>
> > > > Try something like this where value="delete" or "update"
> > > >   ie.radio(:name,'act2[165]',value).focus
> > > >   ie.radio(:name,'act2[165]'',value).set- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to