:class should work as well to identify the table, if the text you're
getting from tables has the same class attribute.

It's a bit hard to read, but then you want to pull the text from the
cell, which is easy:

foo.table(:class, 'box3')[1][1].text

something like that and then parse the text that's returned. Are you
able to get that far? Let me know how far you can get.

Worst case scenario, you could use xpath, I'm not a huge fan and can't
give you examples, but you can look that up as well.

hth,

Charley Baker
Lead Developer, Watir, http://watir.com



On Thu, Dec 9, 2010 at 1:01 PM, watirboy <enrique.j.ma...@gmail.com> wrote:
> Just to clarify, I am trying to get the number next to XYZ in the HTML
> and echo it out.
>
> On Dec 9, 2:58 pm, watirboy <enrique.j.ma...@gmail.com> wrote:
>> Due to security purposes, I stripped out any identifying info from
>> tags and either just deleted it or replaced it with lorem ipsum (only
>> one part has that). There were no names or ids on any of the tags, and
>> all that i left was class. Thanks for the help :)
>>
>> <html>
>> <body >
>>         <table >
>>                 <tr>
>>                         <td >
>>                         <form name="main" method="post" >
>>
>> <table >
>>         <tr>
>>                 <td >
>>
>>                 </td>
>>         </tr>
>>         <tr>
>>                 <td >
>>
>>                 </td>
>>         </tr>
>>   <tr class="box3">
>>
>>         </td>
>>         <td >
>>
>>         </td>
>>         <td >
>>
>>         </td>
>>
>>         <td >
>>             <font ></font><br>
>>             <font ></font><br>
>>             <font ></font><br>
>>         </td>
>>         <td >
>>             <font ></font><br>
>>                  <input name="" type="hidden" value="">
>>             <font ></font><br>
>>                  <input name="" type="hidden" value="">
>>             <font ></font></br>
>>                  <input name="" type="hidden" value="">
>>         </td>
>>
>>   </tr>
>> </table>
>> <div ></div>
>> <table class="box1" >
>>   <tr>
>>         <td >
>>
>>         </td>
>>   </tr>
>> </table>
>> </body></html>
>>
>>                                 <table >
>>                                         <tr>
>>                                                 <td >
>>                                                         <table >
>>                                                                 <tr>
>>                                                                         <td  
>> >
>>                                                                              
>>    <h6></h6>
>>                                                                         </td>
>>                                                                 </tr>
>>                                                                 <tr>
>>                                                                         <td  
>> ><hr><br></td>
>>                                                                 </tr>
>>                                                         </table>
>>                             <table class="box3">
>>                                         <tr>
>>                                                 <td>
>>                                                 <p >
>>                                                 <font size=2>Lorem Ipsum 
>> XYZ123456.<BR>Lorem Ipsum.<BR>Lorem
>> Ipsum</font><BR><br><input type="button" name="new" value="New"
>> onclick="javascript: window.location.href='';">
>>                                                 </p>
>>                                         </td></tr>
>>                                 </table>
>>                                 <br>
>>                                 <table >
>>                                         <tr>
>>                                                 <td >
>>                                                         <iframe 
>> src="..."></iframe>
>>                                                 </td>
>>                                         </tr>
>>                                 </table>
>>
>>                                 <br>
>>                           </td>
>>                         </tr>
>>                   </table>
>>             </center>
>>       </div>
>>     </form>
>>   </td>
>> </tr>
>> <table >
>> <tbody>
>>         <tr>
>>                 <td  >
>>                         <font >
>>                                 <br>
>>
>>                         </font>
>>
>>                                 <font >
>>
>>                                         <hr>
>>                                 </font>
>>
>>                         <br>
>>
>>                                         <a href=""><font ></font></a>
>>
>>                                 <font > . </font>
>>
>>                         <a href=""><font   ></font></a>
>>                                 <font   >  </font>
>>                 </td>
>>         </tr>
>>         <tr>
>>                 <td >
>>                         <font></font>
>>                 </td>
>>         </tr>
>>         <tr>
>>                 <td>
>>                         <iframe src="..."></iframe>
>>                 </td>
>>         </tr>
>>
>> </tbody>
>> </table>
>>
>> </table>
>> </body>
>> </html>
>>
>> On Dec 9, 2:17 pm, Charley Baker <charley.ba...@gmail.com> wrote:
>>
>> > Can you give a snippet of the mangled html? I'm sure there's a way to find 
>> > it.
>>
>> > Cheers,
>>
>> > Charley
>>
>> > On Thu, Dec 9, 2010 at 12:13 PM, watirboy <enrique.j.ma...@gmail.com> 
>> > wrote:
>> > > Odd situation. The developers at my site are using legacy code that is
>> > > screwed up HTML. Basically for my WATIR script I need to echo out the
>> > > next 6 characters after the string I am searching for. Usually I would
>> > > just dig deep into the TD cells, but they are all jumbled. Does anyone
>> > > have any idea how I can do this?
>>
>> > > Normally I would just RegEx the IE Contains, but I need to make sure
>> > > that it displays after the wording. In my real world example, I need
>> > > to look for the company's name (XYZ) and grab the generated digits
>> > > after it:
>>
>> > > After creating a policy for XYZ Corporation, the generated number on
>> > > the page is:
>>
>> > > XYZ123456987
>>
>> > > I need to grab the number after XYZ
>>
>> > > No hidden inputs, and the priority on fixing this is low for this
>> > > customer.
>>
>> > > --
>> > > Before posting, please readhttp://watir.com/support. In short: search 
>> > > before you ask, be nice.
>>
>> > > watir-general@googlegroups.com
>> > >http://groups.google.com/group/watir-general
>> > > watir-general+unsubscr...@googlegroups.com
>
> --
> Before posting, please read http://watir.com/support. In short: search before 
> you ask, be nice.
>
> watir-general@googlegroups.com
> http://groups.google.com/group/watir-general
> watir-general+unsubscr...@googlegroups.com
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to