Are Xpath attribute values case insensitive?

Ask general questions here.
User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Are Xpath attribute values case insensitive?

Post by Aracknid » Thu Aug 11, 2011 4:17 pm

I was wondering if the attribute values are case insensitive, and if so can they be made sensitive?

For example, if I have an anchor with innertext "ABC" and I look for it as follows, will it find it?
MyAnchor = ".//a[@innertext='abc']"
And if it is case insensitive and the above works, how could I make it sensitive if I had 2 items, one with innertext "ABC" and one with innertext "abc", using the same code above, to find "abc" and not "ABC"?

Thanks,

Aracknid.

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Are Xpath attribute values case insensitive?

Post by Aracknid » Thu Aug 11, 2011 4:23 pm

Never mind. I found the answer. It is case sensitive by default. Need to do this to make it insensitive:
MyAnchor = ".//a[@innertext~'(?i:abc)']"
Aracknid

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Are Xpath attribute values case insensitive?

Post by Aracknid » Thu Aug 11, 2011 4:34 pm

So, is there a way to override the Xpath behaviour so that it is always case insensitive by default?

And then I would do the opposite and code in something to look for it to be sensitive like this made up example:
MyAnchor = ".//a[@innertext~'(?s:abc)']"

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Are Xpath attribute values case insensitive?

Post by Support Team » Thu Aug 11, 2011 6:03 pm

Aracknid wrote:So, is there a way to override the Xpath behaviour so that it is always case insensitive by default?
No, sorry, there is no such functionality available. The default is case sensitivity.

Regards,
Alex