我正在尝试从此html中删除此文本 == “1532.6788418669355” 。但是,没有任何我尝试似乎工作。 以下是我尝试:如何使用Selenium Webdriver在此HTML内获取此文本?
- IList的选项= Driver.FindElements(By.XPath( “.//跨度// *”)); 选项[0]。文本= “” 这里没有其他有用的性质
- Driver.FindElements(By.XPath( “// B”)); 以及这里没有文字和仅1项返回
- Driver.FindElements(By.XPath( “// DIV [@类= 'highcharts-提示'] /跨度”)) 计数= 1 否文字在此元素或者
<div class="highcharts-tooltip" style="position: absolute; left: 83px; top: 15px; visibility: hidden;">
<span id="ext-gen1350" style="position: absolute; white-space: nowrap; font-family: " Lucida Grande ","Lucida Sans Unicode
",Verdana,Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(51, 51, 51); margin-left: 0px; margin-top: 0px; left: 8px; top: 8px;" zindex="1">
<span style="color:#000000">Index</span>
<br/>
<b>< 600</b>
1532.6788418669355
</span>
</div>
这里是我TRIE其他的东西d得到一些反馈后。所有这些或者返回空或元素未发现异常:
var options = Driver.FindElements(By.XPath(“// div [@ class ='highcharts-tooltip'] // following :: span”)) ; (“.text”)()。GetAttribute(“textContent”);方法如下: ();}}。GetAttribute(“textContent”);}}。GetDocument(“textContent”); ();}}。GetAttribute(“textContent”);}}。GetDocument(“textContent”); (“textContent”);}}。GetAttribute(“textContent”);}}。GetAttribute(“textContent”); ());}}。GetAttribute(“text”);}}。GetAttribute(“text”);
var a = Driver.FindElement(By.XPath(“// * [@ class ='highcharts-tooltip']/span/text()”));此xpath完美工作在Firebug中,但未使用Webdriver ...
// var b = Driver.FindElements(By.XPath(“// * [@ class ='highcharts-tooltip']/span/text ()“));
感谢您的帮助!但是,这并不适用于我,因为C#没有getText()方法。并使用.Text让我“”。 –