【发布时间】:2021-05-03 00:55:49
【问题描述】:
这是我的html代码
<h2>==$0
"How"
"Are You"
</h2>
编写定位器如//h2/text()[1] 获取“如何”文本并编写//h2/text()[2] 获取“你是”文本对我不起作用。抛出以下错误
onException - WebDriver error:
<font color= 'red' size='3.5'>org.openqa.selenium.InvalidSelectorException: invalid selector: The result of the xpath expression "//h2/text()[2]" is: [object Text]. It should be an element.
【问题讨论】: