Hi Jevon,

The following code worked for me by using start-with and contains in the
XPath. Thought I will post it here as it might be useful for someone.

Thank you!
Lakshmi


assertElementPresentByXPath("//a[starts-with(@href, '
http://www.company.com/wps/portal/!ut/p/_s.7_0_A/7_0_1OB?') and contains
(@href, 'navid=FOIA')]");

clickElementByXPath("//a[starts-with(@href, '
http://www.company.com/wps/portal/!ut/p/_s.7_0_A/7_0_1OB?') and contains
(@href, 'navid=FOIA')]");


On Tue, Mar 9, 2010 at 4:05 PM, Jevon Wright <je...@jevon.org> wrote:

> Hi,
>
> Sounds like the XPath is not correct. You could check with
> getElementByXPath() which will throw additional exception information if
> necessary. Special characters such as & may need to be escaped.
>
> Since you are checking for a URL, the URL may often change so this may not
> be the best approach. It may be best to search for <a> by ID.
>
> Jevon
>
>   On Wed, Mar 10, 2010 at 5:27 AM, lakshmi somavaram <lsomava...@gmail.com
> > wrote:
>
>>   Dear Users,
>>
>> I have trouble using assertElementByXPath for the following link. JWebUnit
>> says unable to find element.
>>
>> Please let me know how to handle the special characters in XPath.
>>
>> *HTML code:*
>> **
>> <a href="
>> http://www.company.com/wps/portal/!ut/p/_s.7_0_A/7_0_1OB?navtype=FT&amp;navid=FOIA<http://www.company.com/wps/portal/%21ut/p/_s.7_0_A/7_0_1OB?navtype=FT&navid=FOIA>
>> ">FOIA</a>
>>
>> *Jwebunit code:*
>>
>> assertElementPresentByXPath("//a...@href*='
>> http://www.company.com/wps/portal/!ut/p/_s.7_0_A/7_0_1OB?navtype=FT&amp;navid=FOIA'<http://www.company.com/wps/portal/%21ut/p/_s.7_0_A/7_0_1OB?navtype=FT&navid=FOIA%27>
>> ]");
>>
>> Thank you,
>>
>> Lakshmi
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> JWebUnit-users mailing list
>> JWebUnit-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> JWebUnit-users mailing list
> JWebUnit-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>
>
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to