如何获取当前节点的内容

时间:2014-12-18 09:39:53

标签: c# xpath selenium-webdriver

我有一个html源代码如下

 <div class="home">
    <table class="player" style="top:xx;left:yy"><tbody>...</tbody</table>
    <table class="player" style="top:xx;left:yy"><tbody>...</tbody</table>
    <table class="player" style="top:xx;left:yy"><tbody>...</tbody</table>
    <table class="player" style="top:xx;left:yy"><tbody>...</tbody</table>
 </div>

获得球员:

var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
var ele = wait.Until(ExpectedConditions.ElementExists(By.ClassName("home")));
var players = ele.FindElements(By.ClassName("player"));

是否有任何有效的方法来获取整个表格内容

  foreach (var player in players)
  {
      var html = player.GetAttribute("innerHTML");  >> only get <tbody> stuff 
  }

0 个答案:

没有答案