Are Xpath attribute values case insensitive? : General Questions

Are Xpath attribute values case insensitive?

Ask general questions here.

Are Xpath attribute values case insensitive?

Postby Aracknid » Thu Aug 11, 2011 5: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: 126
Joined: Tue Aug 10, 2010 4:23 pm
Location: Toronto, Ontario, Canada

Re: Are Xpath attribute values case insensitive?

Postby Aracknid » Thu Aug 11, 2011 5: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: 126
Joined: Tue Aug 10, 2010 4:23 pm
Location: Toronto, Ontario, Canada

Re: Are Xpath attribute values case insensitive?

Postby Aracknid » Thu Aug 11, 2011 5: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
Aracknid
 
Posts: 126
Joined: Tue Aug 10, 2010 4:23 pm
Location: Toronto, Ontario, Canada

Re: Are Xpath attribute values case insensitive?

Postby Support Team » Thu Aug 11, 2011 7: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
User avatar
Support Team
Site Admin
 
Posts: 4837
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to General Questions

Who is online

Users browsing this forum: No registered users and 0 guests