如果Xpath包含法语特殊字符(èd'),则Xpath似乎无法正常工作,并出现以下错误
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.
正在运行Windows机器,也为File更改了EOL(UTF-8,基于unix),但不起作用。
[当我们以英语本地化运行时,这很好用
[在XPath中使用è
字符没有任何问题。
另一方面,d'
不是单个字符,而是一个d
,后跟一个单引号'
,并且这是单引号,它干扰了在XPath中用作字符串定界符的单引号。