Page 1 of 1

Are Xpath attribute values case insensitive?

Posted: Thu Aug 11, 2011 4:17 pm
by Aracknid
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.

Re: Are Xpath attribute values case insensitive?

Posted: Thu Aug 11, 2011 4:23 pm
by Aracknid
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

Re: Are Xpath attribute values case insensitive?

Posted: Thu Aug 11, 2011 4:34 pm
by Aracknid
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)']"

Re: Are Xpath attribute values case insensitive?

Posted: Thu Aug 11, 2011 6:03 pm
by Support Team
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