Thanks for the pointer!
I'm getting closer to finding that pesky string. Here's what I've written
after reading your links;
ie.frame("foo").tables.each do |t|
puts "since you don't have ID's, look at every table"
puts t
for i in 1..t.row_count
puts "for every row in this table"
puts i
t[i].each do |cell|
puts "for every column in this row, look at its contents"
puts cell
if ie.text.include? "Password:"
puts "if true, this is your cell"
puts cell.text
end
end
end
end
and then I end up with;
C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/table.rb:294:in `each':
undefined method `length' for nil:NilClass (NoMethodError)
from C:/Documents and Settings/eric.mathiesen/Desktop/fc90-script/845-Mo
dified/BVT/BVT-17815/debug.rb:27
from C:/script/debug.rb:23:in `each'
from C:/script.rb:23
from
C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element_collections.rb:45:in
`each'
from
C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element_collections.rb:45:in
`upto'
from
C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element_collections.rb:45:in
`each'
from C:/script.rb:20
Line 20 is;
ie.frame("foo").tables.each do |t|
On Fri, Nov 5, 2010 at 2:46 PM, Basim Baassiri <[email protected]> wrote:
> What code have you tried?
>
> You could use Xpath to retrieve the value looking at the class (if its
> unique to the page)
> http://wiki.openqa.org/display/WTR/XPath
>
> Try reading about tables
> http://rdoc.info/gems/watir/1.6.6/Watir/Table
>
>
> On Fri, Nov 5, 2010 at 5:32 PM, Eric Mathiesen <[email protected]>wrote:
>
>> Hello All!
>>
>> I am running into a significant challenge capturing a string of text to
>> later use in my script. Here's the situation. I have a basic create user
>> form in my application (First Name, Last Name, Username) that provides a
>> password on the page. How would I go about capturing the string for the
>> password as It changes every time. In the snippet below, the string I want
>> captured is ynH&ZaBK
>>
>> Any help is GREATLY appreciated!
>>
>> Viewing source gives me this (condensed to the fields I'm working with).
>>
>>
>> <tr align="left" valign="middle">
>> <td width ="50%" height ="20" >
>> <table width="100%" border="0" cellpadding="0" cellspacing="0" >
>> <tr class="formHeaderSkinBG" >
>> <td width="50%" height="" >
>> <table width="100%" border="0" cellpadding="0"
>> cellspacing="1" >
>> <tr class ="formHeaderBG" >
>> <td width ="50%" height ="20" class
>> ="formHeader" id='3081488100560284032' onclick =
>> "root.handleOnClick(document, this);" >
>>
>>
>> Password:
>>
>>
>>
>> <nobr>
>> </td>
>> </tr>
>> </table>
>> </td>
>> </tr>
>> </table>
>> </td>
>>
>> <td class="pageContent" width="" align="left" valign="middle" height="20"
>> >
>>
>> ynH&ZaBK
>>
>> </td>
>>
>> </tr>
>>
>> Thanks,
>> Eric
>>
>> --
>> Before posting, please read http://watir.com/support. In short: search
>> before you ask, be nice.
>>
>> [email protected]
>> http://groups.google.com/group/watir-general
>> [email protected]<watir-general%[email protected]>
>>
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]<watir-general%[email protected]>
>
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]