I think the answer is somewhere in your suggestion.
The element(s) that I am looking for is quite deep in several nested
FRAMESET/FRAME/FRAMESET/FRAME/...
Is there a way in Watir/Ruby to say "in any frame, no matter how deep"?
If not, how do I traverse them? Can I do something like:
ie = Watir::IE.new
frame1 = ie.frame(:id, "contentFrame")
frame2 = frame1.frame(:id, "frameTop")
...etc.

Thank You all for the help so far.


2009/3/17 Michael Hwee <michael_h...@yahoo.com>:
>
>
> So, you might want to try:
> $ie.frame(:index,1).text.include?("Activating the database")
>
>
>
>
> ----- Original Message ----
> From: Mark Lehky <mark.le...@aclaro.com>
> To: watir-general@googlegroups.com
> Sent: Tuesday, March 17, 2009 10:20:03 AM
> Subject: [wtr-general] Re: Problems locating basic elements in Watir
>
>
> The puts ie.html.inspect generates:
> <HTML>
> <HEAD>
>   <TITLE>petroLook - aclaro softworks, inc.</TITLE>\r\n
>   <META content=favorite name=save>
> </HEAD>
> <FRAMESET tabIndex=999>
>   <FRAME id=contentFrame tabIndex=999
> src=\"/petroLook4410/plugins/cache/webresources/aclaro_petroLook_WebResources/4_4_3353_10382/WebPages_Administration_AdministrationFrameset.aspx?category=Bootstrap\">
> </FRAMESET>
> </HTML>"
>
> So apparently there is nothing there. :( Now what do I do?
>
>
> 2009/3/17 marekj <marekj....@gmail.com>:
>> Welcome to Ruby and Watir.
>> Glad you jumped in. It's a great language and Watir is a nice library.
>>
>> about your issue: you may try right after you login click to capture the
>> html and see what's there; try with;
>> puts ie.html.inspect
>> after ie.button(how, what).click line
>>
>> Another possible issue may be a hidden frame (frameset). Just a wild guess
>> since I've seen it happen in a couple of apps I worked with.
>>
>> Also I noticed that the HTML generated by IEDeveloperToolbar is not really
>> the HTML that's on the page. The IEDevToolbar adds its own head info for
>> meta doctype and styles.
>>
>>
>> marekj
>>
>> Watirloo: Semantic Page Objects in UseCases
>> http://github.com/marekj/watirloo/
>>
>>
>>
>> On Tue, Mar 17, 2009 at 10:05 AM, Mark Lehky <mark.le...@aclaro.com> wrote:
>>>
>>> Hello all.
>>>
>>> I am new to Watir as well as Ruby, but have had experience with other
>>> tools and languages. Installed Ruby+Watir (no issues), ran through the
>>> basic tutorial, everything worked just fine.
>>>
>>> I then tried to create the first test for my AUT. The test was quite
>>> simple: login and try to locate some text on the next page.
>>> The login portion worked: found the two text boxes
>>> (username/password), found the login button. However, the next page is
>>> effectively blank to Watir. For any element that I tried to .flash, I
>>> always got the error:
>>> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
>>> `assert_exists': Unable to locate element, using :id, "c_ddlCategory"
>>> (Watir::Exception::UnknownObjectException)
>>>     from
>>> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:239:in
>>> `flash'
>>>     from petroLook_login.rb:15
>>>
>>> After searching through past posts here, I was led to Webmetrics RIA
>>> Script Recorder. That tool cannot "see" of the elements either -
>>> nothing is recorded after the login page. :(
>>>
>>> Here is my sample Watir test:
>>> require "watir"
>>> test_site = "http://localhost/petroLook4410";
>>> ie = Watir::IE.new
>>> ie.goto test_site
>>> if ! ie.text.include? "Login"
>>>   puts "Test Failed! Could not find: 'Login'."
>>>   exit 1
>>> end
>>> ie.text_field(:id, "c__txtUsername").set "bootstrap"
>>> ie.text_field(:id, "c__txtPassword").set "bootstrap"
>>> ie.button(:id, "c__btnLogin").click
>>> # everything past this point is "gone"
>>> if ! ie.text.include? "Activating the database"
>>>   puts "Test Failed! Could not find: 'Activating the database'."
>>>   exit 1
>>> end
>>> puts "All good!"
>>> exit 0
>>>
>>> Here is the HTML code snippet grabbed from IE Developer Toolbar of the
>>> above text (I wonder how e-mail clients are going to handle this - I
>>> am typing this in plaintext-mode):
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Transitional//EN">
>>> <META http-equiv="Content-Type" content="text/html; charset=windows-1252">
>>> <HTML class=" page" id="html">
>>> <HEAD>
>>> <STYLE> /* No matching styles were found. */ </STYLE>
>>> </HEAD>
>>> <BODY class=" page ie" id="body">
>>>  <FORM id="frmControlHost" name="frmControlHost"
>>>
>>> action="WebPages_ControlHost.aspx?control=aclaro.petroLook.WebControls.Generic.PageHost&pagetype=Admin&category=Bootstrap&group=Schema"
>>> method="post">
>>>   <P>Activating the database enables petroLook users to log in and
>>> disables the bootstrap user. </P>
>>>  </FORM>
>>> </BODY>
>>> </HTML>
>>>
>>> TIA for any help.
>>>
>>>
>>
>>
>> >
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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