Frame object always checked before you can use it.




----- Original Message ----
From: Tony <ynot...@gmail.com>
To: Watir General <watir-general@googlegroups.com>
Sent: Wednesday, April 8, 2009 2:30:49 AM
Subject: [wtr-general] Creating Frame objects before a page with a frame exists


Hi,

Having trouble creating a frame object before a particular page
contains the object.

The framework contains an object repository which contains all the
objects and methods that act on a particular page.Using textfields,
links, buttons etc work fine, because this is not checked on the page
if it exists when the object is created.But when creating a frame
object, it is checked against the current page if the frame exists,
which does not allow you store the frame objects.

Below is an example-
class Videopage
  def initialize(brow)
    usrtxtfield = brow.frame(:id, "loginframe").text_field
(:id,"lgnId1")
    srchtxtfield = brow.text_field(:id, "topQuery2")
  end
#... other methods doing complex steps like login etc
end

Now the test code will require the above file.
require 'watir'
require 'watir/ie'
require 'Videopage' #--- object repository file
class Checktest < Test::Unit::TestCase
  def test_thisframe
    Watir::Browser.default = "ie"
    mybrow = Watir::Browser.new
    vid = Videopage.new(mybrow)
    mybrow.goto("http://video.aol.com";)
    mybrow.link(:text, "Sign In").click
    sleep 5
  end
end

This returns an error "in `locate': Unable to locate a frame using id
and loginframe.  (Watir::Exception::UnknownFrameException)"

Is there a way to avoid the frame object from checking if the frame
exists on the page when it is being created?
Check only when doing an action on the frame or object within the
frame.
Want it to act like text_fields, buttons , links etc ....

The other way to store the frame object i found was, by using it as a
string.
Is there any other way ???
example -
txtfield = 'mybrow.frame(:id, "loginframe").text_field(:id, "lgnId1")'
eval(txtfield).set("newone")

Thanks,
Tony

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