Can you please let me know to to write xpaths having the text
attribute case-insensitive
Like for the below example.
xpath=//a[text()='MANIFEST']
Thanks
you can do this by storing the text, just go through bellow code.
String text = selenium.getText("your xpath");
if(text.trim().equalsIgnoreCase("MANIFEST"))
{
true;
}
else
{
false;
}
Thanks
Ritesh
Try this instead:
//a[translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')='manifest']
> --
> You received this message because you are subscribed to the Google Groups
> "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com.
> To unsubscribe from this group, send email to
> selenium-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/selenium-users?hl=en.
>
>
--
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
If you have received this email in error please notify postm...@ardescosolutions.com
xpath=//a[lower-case(text())='MANIFEST']
This of course only works if your browser supports XPath 2.0:
http://www.w3.org/2005/xpath-functions/#lower-case. If it does not,
you'll have to use the XPath 1.0 function translate as Mark
demonstrates.
Darrell
That's not really answering the OP's question.Try this instead:
//a[translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')='manifest']
> Hi,
>
> you can do this by storing the text, just go through bellow code.
>
> String text = selenium.getText("your xpath");
> if(text.trim().equalsIgnoreCase("MANIFEST"))
> {
> true;
> }
> else
> {
> false;
> }
>
> Thanks
> Ritesh
>
> On Mar 31, 4:51�am, Getafix <ashg...@gmail.com> wrote:
>> Hello everyone
>>
>> Can you please let me know to to write xpaths having the text
>> attribute case-insensitive
>> Like for the below example.
>>
>> xpath=//a[text()='MANIFEST']
>>
>> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com.
> To unsubscribe from this group, send email to
> selenium-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/selenium-users?hl=en.
>
>