使用selenium的机器人测试,不是有效的XPath表达式。如果元素在Xpath(èd')中包含法语特殊字符

问题描述 投票:0回答:1

如果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),但不起作用。

[当我们以英语本地化运行时,这很好用

python-2.7 xpath selenium-chromedriver robotframework
1个回答
0
投票

[在XPath中使用è字符没有任何问题。

另一方面,d'不是单个字符,而是一个d,后跟一个单引号',并且这是单引号,它干扰了在XPath中用作字符串定界符的单引号。

© www.soinside.com 2019 - 2024. All rights reserved.