Hi
   You can use contains for the id so that it can be used for regular
expression. I remeber posting this on the mailing list some time back . If
you cannot search it I will try and search and then post it here

Regards
Hari

On Wed, May 20, 2009 at 2:25 PM, Naegreth <[email protected]>wrote:

> Hi and thanks for your help!
>
>
> >> what error is WebTest reporing?
>
> Well, using clickElement it doesn't report an error for the clickElement
> but for the next step.
>
> All seems fine but it does not request for the next page.
>  1) I verified the h2 element text of the first page (that's ok), then
>  2) I tried to get to the next page using clickElement (WebTest is
> reporting no error) and
>  3) I verified the h2 heading of the next page (Webtest reporting there
> is no such text)
> so i realized WebTest's current page is still the first one.
>
> I changed the test to
> 1) verify the first page heading (still fine)
> 2) click the Element to get to the next page (still no error reporting)
> 3) verify the first page heading again ( fine - what acutually is not
> that fine...)
>
>
> > according to the other mailing list thread the issue is due to those
> > ID's changing each time the layout is changed, making the test very
> brittle.
>
> Ok... I must have mistaken that... my ID's seem to be ok as all other
> elements use them and there is no problem.
>
>
>
> > You'll either need to click the inputs based on their position (also
> > very fragile) or relative location based on some text nearby that
> > doesn't change (have a read about xpath axes like previous-sibling etc).
>
> Hmm... ok. I've never used xPath (or even axes) before this and I'll
> have a closer look . But if it needs some other "static" text nearby
> another problem could be, that there is no such text...
>
>
>
> > How about using the image name in the src url? e.g. clickElement
> > xpath:"//input[contains(@src,'theImageFile.gif')]"
>
> I've used:
> <clickElement
>    xPath="//input[contains(@src,'/path/to/image.jpg')]"
> />
>
> And it's also not causing an error on the current test (although it
> should cause an error, because I'm still verifing agains the headline of
> the first page).
>
> Anyway, what is the reason why it doesn't cause an error? Is that a
> normal behaviour?
>
>
> Cheers
>
> Miriam
>
>
> Lee Butts wrote:
> > Hi,
> >
> > according to the other mailing list thread the issue is due to those
> > ID's changing each time the layout is changed, making the test very
> brittle.
> >
> > You'll either need to click the inputs based on their position (also
> > very fragile) or relative location based on some text nearby that
> > doesn't change (have a read about xpath axes like previous-sibling etc).
> >
> > How about using the image name in the src url? e.g. clickElement
> > xpath:"//input[contains(@src,'theImageFile.gif')]"
> >
> > cheers
> >
> > Lee
> >
> > 2009/5/20 Lee Butts <[email protected] <mailto:[email protected]>>
> >
> >     Hi Miriam,
> >
> >     what error is WebTest reporing?
> >
> >     cheers
> >
> >     Lee
> >
> >     2009/5/20 Naegreth <[email protected]
> >     <mailto:[email protected]>>
> >
> >         Hi,
> >
> >         I am new to Webtest and I have a problem testing a jboss based
> >         web-app
> >         that uses jsf.
> >
> >         I have a button-like input element with an onclick event to get
> >         to the
> >         next page:
> >
> >         <input id="_idJsp26:_idJsp55" type="image" src="<path>"
> >
> onclick="A4J.AJAX.Submit('_viewRoot','_idJsp26',event,{'parameters':{'_idJsp26:_idJsp55':'_idJsp26:_idJsp55'}
> >         ,'actionUrl':'<path>.jsf?javax.portlet.faces.DirectLink=true'}
> >         );return
> >         false;" name="_idJsp26:_idJsp55"/>
> >
> >         Everything worked fine so far except for this one.
> >         I tried to use clickElement with the htmlId and xPath as
> >
> >         <clickElement xPath="//*...@id='_idJsp26:_idJsp55']"/>
> >         and
> >         <clickElement htmlId="_idJsp26:_idJsp55"/>
> >
> >         I have no problems calling standart types for input elements
> >         (e.g. text)
> >         with similar IDs, so I assume it's not up to this.
> >
> >         I already had a look at the list's archives and found a similar
> >         problem
> >         (http://lists.canoo.com/pipermail/webtest/2008q2/010653.html )
> >         but I'm
> >         afraid I don't really get the point...
> >
> >         Can someone please give me a hint what to use or to try next?
> >
> >         Kind regards,
> >         Miriam
> >
> >         _______________________________________________
> >         WebTest mailing list
> >         [email protected] <mailto:[email protected]>
> >         http://lists.canoo.com/mailman/listinfo/webtest
> >
> >
> >
>
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>

Reply via email to