Tom,
This is a method I use which may work for you:
Use storeRegEx to find something unique about the url for the item you wish to
click. In my example, I have an argument called cat_id which is used by the
script addCategory.pl. Store that in a dynamic property as in the example below
called active.category
<storeRegEx group="1"
text="addCategory.pl\?cat_id=([0-9]{1,6})&action=edit">Edit</a></td><td>LicCatAddRemove#{random.category}${server.name}"
property="active.category"/>
Use the clickLink step with the combination of href and label. This functions
like an "and" to match the link that has a href containing the text
"cat_id=12543" (assuming the result of the match from the storeRegEx step above
was "12543") and a label text "Edit".
<clickLink href="cat_id=#{active.category}" label="Edit"/>
This allows me to select a particular link from a table of links that all have
a link labelled "Edit" with a URL using a id number as an argument that I can
get by inspecting the page with storeRegEx.
I probably don't need the label portion because webtest would look for the
first match of a href field with "cat_id=12543" which is likely unique.
Cheers,
Tim Pezarro
Manager, Web Services
[email protected]
Phone: +1-604-415-6044
Cell: +1-604-762-1000
Fax: +1-604-415-6602
PMC-Sierra, Inc.
100-2700 Production Way
Burnaby, BC, Canada
V5A 4X1
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Angel Merrett
> Sent: Thursday, October 08, 2009 5:07 AM
> To: [email protected]; tom hanekamp
> Subject: Re: [Webtest] Problem using Webtest and DOM tree's
>
> Tom - have you checked the source for the page to see if the
> item you are looking for actually does exist? If it doesn't
> exist in the source then it's likely dynamically created
> using javascript. I have the same issue and have not yet
> been able to resolve it so if you find a way, please share! :)
>
> Angel
>
> On Thu, Oct 8, 2009 at 6:05 AM, tom hanekamp
> <[email protected]> wrote:
> > Hi there
> >
> > Before I asign my problem, I must admit that I`m not a pro
> in webtest.
> >
> > The website or rather webapplication that I`m trying to
> test contains
> > a hierarchy of items coming from a database. The moment you
> click one
> > of the items, the page will show some textual information regarding
> > the item you click.
> >
> > The problem is that when I`m trying to get webtest to select one of
> > the items, so I can test if the webapplication does indeed
> display the
> > right information, I always get failed results saying they
> cannot find
> > the item within the page.
> >
> > Is there a way for me to have webtest reach these items?
> >
> > Many thanks
> >
> > Tom
> >
> > ________________________________
> > What can you do with the new Windows Live? Find out
>
>
>
> --
> Hanlon's Razor: ``Never attribute to malice that which can be
> adequately explained by stupidity''.
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest