[Webtest] extract target location from a javasdript command

Dierk Koenig webtest@lists.canoo.com
Fri, 5 Sep 2003 10:09:06 +0200


Hi,

the general attempt is ok, but
invoke expects a url, not a javascript function call.

The idea is to assign a url to the dynamic property and then
use it in the invoke.

assuming your function "submitForm_NextSelection()" contains something like

	navigate("myUrl?a=b");

the storeregex is something like

     <storeregex
             stepid="Extract target location from javascript function"
             text=".*navigate.*?\b([a-zA-z?=&%0-9_]*).*"
             group="0"
             property="myUrl"/>

The fairly complicated regex means
- look for navigate
- ignore everything until the next word boundary
- store any allowed url characters
- ignore what follows

cheers
Mittie

P.S. I agree that things get messy here. Some would attribute this to
WebTest.
I personally attribute this to the use of javascript.



> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of Richard Raue
> Sent: Freitag, 5. September 2003 9:36
> To: webtest@gate.canoo.com
> Subject: [Webtest] extract target location from a javasdript command
>
>
> Hi,
>
> with:
>
>     <storeregex
>             stepid="Extract target location from javascript command"
>             text="onClick='submitForm_NextSelection\(\)'"
>             group="0"
>             property="regex-test"/>
>
> I extracted the following part out of a javascript command:
>
>         onClick='submitForm_NextSelection()'
>
> so here's my question: How can I invoke the target page with that
> property?
> I allready tried the example, given in the syntax reference on
>
> http://webtest.canoo.com/webtest/manual/syntax.html
>
> that is (in my case):
>
>     <invoke
>             stepid="Getting next page..."
>             url="#{regex-test}"/>
>
> But ANT just add this url-expression to the host-url [means: http://..
> ../onClick='submitForm_NextSelection()]
>
> What did I wrong?
>
> many greetings,
> Richard
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>
>