【发布时间】:2013-12-20 15:07:38
【问题描述】:
我在 Internet Explorer 10 中执行和执行 xpath 功能时遇到问题。它在 Firefox 甚至 Chrome 上都能完美运行,但在 IE 上却失败了。我需要搜索以下错误信息:
We cannot find this car, please click on "I don't know my car reg" above
这个消息的问题是双引号和不要的引号。
无法使用:
//span[@id='id']//*[text()='We cannot find this car, please click on "I don't know my car reg" above']
或
//span[@id='id']//*[text()="We cannot find this car, please click on "I don't know my car reg" above"]
所以我尝试了这个:
//span[@id='id']//*[text()=concat('We cannot find this car, please click on "I don',"'",'t know my car reg" above')]'
concat 函数在 chrome 和 fiferox 中完美运行,但在 IE 中出现以下异常:
org.openqa.selenium.InvalidSelectorException: The xpath expression '//span[@id='quoteForm:registrationLookupPart:m1']//*[text()=concat('We cannot find this car, please click on "I don',"'",'t know my car reg" above')]' cannot be evaluated or does notresult in a WebElement (WARNING: The server did not provide any stacktrace information)
有人知道为什么 Selenium IE 驱动会抛出这个异常吗?
它看起来像 concat 函数,或者在 IE 中不存在,或者工作方式不同。这是真的吗?
非常感谢
【问题讨论】:
标签: internet-explorer selenium xpath concat