【发布时间】:2016-02-29 03:48:09
【问题描述】:
从 HTML 如下所示,我想只获取 <p> 中没有文本的文本,即 <span> 元素中的文本:
<p>Text I want <span class="orange_font inner_subtitle">Some text</span></p>
此代码现在也在<span> 元素中返回文本,如何避免这种情况?
val result: WebElement = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='container']/p/span")))
result.getText()
【问题讨论】: