???????????
????1. ???????????е?tr???浽list????
????2.??tr?????????????????tr????????????td?????浽list????
????3.?????????td??????
????????????
package com.example.tests;
import static org.junit.Assert.*;
import java.util.*;
import org.junit.*;
import org.openqa.selenium.*;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class Selenium2 {
WebDriver driver = new InternetExplorerDriver();
JavascriptExecutor jse = (JavascriptExecutor)driver;
@Test
public void tableTest() {
driver.get("http://www.w3school.com.cn/html/html_tables.asp");
//??????????tr?????
List<WebElement> rows = driver.findElements(By.cssSelector(".dataintable tr"));
//???????????
assertEquals(11??rows.size());
//????????????????????
for (WebElement row : rows) {
//??????tr??td?????
List<WebElement> cols =  row.findElements(By.tagName("td"));
for (WebElement col : cols) {
System.out.print(col.getText());//???td??????
}
System.out.println();
}
driver.close();
}
}
???????????
????---------------------------------------------------------------------------------
????<table>??????
????<caption>?????????
????<th>???????????
????<tr>????????С?
????<td>?????????
????<thead>????????ü??
????<tbody>??????????塣
????<tfoot>???????????
????<col>???????????е??????
????<colgroup>???????е??顣