下面是我的表格結構,我使用Selenium使用Java遍歷所有行並捕獲數字「00955222222222
」,它將在任意單元格中隨機顯示。一旦我得到這個,我已經讀完整行並獲得授權代碼。我可以實現直到循環行和列。但需要輸入我如何獲得授權碼?請幫助Java:如何迭代表格單元以隨機更改表格捕獲數字
<table border="2" cellspacing="0" width="100%" cellpadding="0">
<tr bgcolor="#CCCCCC">
<td align="left">
<font face="times new roman" size=3><b> Mobile Number</b></font>
</td>
<td align="left">
<font face="times new roman" size=3><b> Date</b></font>
</td>
<td align="left">
<font face="times new roman" size=3><b> Message</b></font>
</td>
</tr>
<tr bgcolor="#EBD8B8">
<td align="left" nowrap>
<font face="times new roman" size=3> 955111111111</font>
</td>
<td align="left" nowrap>
<font face="times new roman" size=3> 2017-03-14 16:57:20.027</font>
</td>
<td align="left">
<font face="times new roman" size=3> Your authentication code is: 11292 to transfer INR 5,500.00 through online/mobile banking. If you have not requested any transfer, please contact the bank IMMEDIATELY on 00971 600 54 0000 .</font>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left" nowrap>
<font face="times new roman" size=3> 00955222222222</font>
</td>
<td align="left" nowrap>
<font face="times new roman" size=3> 2017-03-14 16:55:30.187</font>
</td>
<td align="left">
<font face="times new roman" size=3> Your authentication code is: 59859 to pay AED 1.00 to Empower through online/mobile banking. Please do not share this code with any person. If you have not requested any payment, please contact the bank IMMEDIATELY on 00971 600
54 0000 .</font>
</td>
</tr>
<tr bgcolor="#EBD8B8">
<td align="left" nowrap>
<font face="times new roman" size=3> 00955111111111</font>
</td>
<td align="left" nowrap>
<font face="times new roman" size=3> 2017-03-14 16:54:46.25</font>
</td>
<td align="left">
<font face="times new roman" size=3> Your authentication code is: 79404 to transfer PKR 7000 through online/mobile banking. If you have not requested any transfer, please contact the bank IMMEDIATELY on 00971 600 54 0000 .</font>
</td>
</tr>
</table>
找到表格並使用「標記名」獲取「tr」列表。遍歷「tr」列表並獲取「td」列表。遍歷「td」並獲得認證碼。如果您只需要驗證碼,請提供一個條件。這是你想要的? – shank087