我想从Selenium和Javascript中的HTML元素中提取一些文本。从内部元素的文本中获取文本
<span class="myAttribute">
<b>SomeValueToIgnore</b>
<span class="ignoreWhatsInside">
<em>ignore_that</em>
</span>
GiveMeJustThat_NothingElse
</span>
我怎样才能提取span元素在Javascript /硒文本 'GiveMeJustThat_NothingElse'? 不幸的是,我不能把文字'GiveMe ...'放到自己的标签中,因为那样会打破其他测试。
为什么不能使用xpath? –
此帖可能有帮助 - http://stackoverflow.com/questions/32479422/how-do-i-get-the-text-of-a-nested-element-in-html-for-automation-using-selenium。谢谢 –
@Mahsum:xpath会很好。 – Bernie