[Webtest] Dealing with frames
Dierk Koenig
webtest@lists.canoo.com
Fri, 16 Aug 2002 11:10:37 +0200
Hi,
while there is currently no support for frames in WebTest, Carlo's
workaround is the way to go if you don't want to go for Stefan's
solution that uses HttpUnit directly.
How could a WebTest step look like, that makes life easier?
<invoke ...>
<followframe name="myname" />
current impl would be
<invoke ...>
<verifyxpath xpath="//frame[@name='myname']" />
<invoke url="myFrameUrl"/>
if myFrameUrl is not known, one can use
storeregex until a better version is available
<storeregex
stepid="Extract frame url from frame tag"
text="(?si)<frame\s[^>]+?\bname\W+(\w+)\b"
group="1"
property="myFrameUrl" />
<invoke
stepid="follow the named frame"
url="#{myFrameUrl}" />
explaining the regex
(?si) single line mode, ignore case
<frame\s <frame or <FRAME, followed by a whitespace char
[^>]+? not the > char, 1 or more times, shortest match
\b a word boundary
name name or NAME
\W+ 1 or more non-Word characters (="' ) and the like
(\w+) myFrameName in group 1, consisting of alpha chars or _
\b final word boundary
The regex could still be improved. It is a little bit too
forgiving like this.
Looking at the resulting complexity I think we should
provide the followframe element.
comments?
Mittie
> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of Stefan G. Renz
> Sent: Freitag, 16. August 2002 9:30
> To: webtest@lists.canoo.com; Carlo E. T. Oliveira
> Subject: Re: [Webtest] Dealing with frames
>
>
> On Thursday 15 August 2002 19:44, Carlo E. T. Oliveira wrote:
> > Is there any primitves to deal with frames? If I invoke a page
> > describing frames, how do I get to each frame? Or could it be a way to
> > find a tag regardless of the frame it appears? I tried the normal
> > primitives but when invoking the framed page it failed. I had to figure
> > out the particular frame url and invoke it to work. I looked for a way
> > to select the frame in the api but did not discovered how.
>
> RTFM: In doc/Cookbook.html, there's a chapter on how to deal with frames.
> Basically, you need to request the page containing the
> <frameset>, then you
> can ask the WebConversation object to return the response of a
> named frame.
> You either need to know the name of the frame, or you can
> retrieve the list
> of currently available frames by WebConversation.getFrameNames().
>
> >
> > Carlo
> >
> Hope it helps,
> ciao
> Stef
>
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>