Html
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css" />
<title>Result</title>
</head>
<body>
<div>
<a href="https://google.com">Google</a>
<a href="https://google.com">Google</a>
<a href="https://google.com">Google</a>
</div>
</body>
</html>
使用上面的Html我想刮掉<table id="tblRenewalList" class="adminlist dataTable" width="100%" cellspacing="1" cellpadding="1" border="1" style="margin-left: 0px; width: 100%;" aria-describedby="tblRenewalList_info">
<thead>
</thead>
<tbody role="alert" aria-live="polite" aria-relevant="all">
<tr class="odd">
<td class="alignCenter">
<input id="chkRenewal_868" class="chkPatent" type="checkbox" onclick="RenewalSelection(this)" companyid="33" value="868">
</td>
</tr>
</table>
以下是我的java代码,当我尝试使用下面的代码时,它返回空值,请找到代码
id, value
以下是我的预期输出
id = chkRenewal_868 值= 868
答案 0 :(得分:2)
该文件格式不正确,我不知道这对webdriver是否重要, 但XPath必须是
//*[@id='tblRenewalList']/tbody/tr[1]/td[1]/input