Pandit Biradar
Pandit Biradar

Reputation: 1877

Invalid XPath with French special characters (è d')

It seems XPath is not working if its contains French special characters(è d'), getting the below Error

InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression 
//*[@class='v-menubar-menuitem']/*[contains(text(), 'Afficher la bibliothèque d'autorisations')] 
because of the following error:

SyntaxError: Failed to execute 'evaluate' on 'Document': 
The string '//*[@class='v-menubar-menuitem']/*[contains(text(), 'Afficher la bibliothèque d'autorisations')]' is not a valid XPath expression.

Running windows machine , changed the EOL(UTF-8, unix based) also for File , but not working .

This works fine when we run in English localization

Upvotes: 1

Views: 759

Answers (1)

kjhughes
kjhughes

Reputation: 111621

There is nothing wrong with using a è character in XPath.

On the other hand, d' is not a single character but a d followed by a single quote ', and it is the single quote that is interfering with the single quotes being used as string delimiters in your XPath.

If you change your string delimiter to use double quotes, then the inner single quote won't be a problem:

//*[@class='v-menubar-menuitem']
 /*[contains(text(), "Afficher la bibliothèque d'autorisations")]

Upvotes: 2

Related Questions