如果前面的元素text()与特定条件匹配,我想提取一个元素.例如,
<html>
<div>
<table class="layouttab">
<tbody>
<tr>
<td scope="row" class="srb">General information: </td>
<td>(xxx) yyy-zzzz</td>
</tr>
<tr>
<td scope="row" class="srb">Website: </td>
<td><a href="http://xyz.edu" target="_blank">http://www.xyz.edu</a>
</td>
</tr>
<tr>
<td scope="row" class="srb">Type: </td>
<td>4-year, Private for-profit</td>
</tr>
<tr>
<td scope="row" class="srb">Awards offered: </td>
<td>Less than one year certificate<br>One but less than two years certificate<br>Associate's degree<br>Bachelor's
degree
</td>
</tr>
<tr>
<td scope="row" class="srb">Campus setting: </td>
<td>City: Small</td>
</tr>
<tr>
<td scope="row" class="srb">Related Institutions:</td>
<td><a href="?q=xyz">xyz-New York</a>
(Parent):
<ul>
<li style="list-style:circle">Berkeley College - Westchester Campus</li>
</ul>
</td>
</tr>
</tbody>
</table> …Run Code Online (Sandbox Code Playgroud)