我需要Selenium案例的帮助。案例是:
日历源代码为:
<tbody>
<tr>
<td class="pad" colspan="1"> </td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
<td>
<a title="What software testing is, It is used for:" href="http://10.28.148.127/wordpress/2013/10/10/">10</a>
</td>
<td>11</td>
<td>12</td>
<td>13</td>
</tr>
<tr>
<td>14</td>
<td>15</td>
<td>16</td>
<td>17</td>
<td>18</td>
<td>19</td>
<td>20</td>
</tr>
<tr>
<td>21</td>
<td>22</td>
<td>23</td>
<td>24</td>
<td>25</td>
<td>26</td>
<td>27</td>
</tr>
<tr>
<td>28</td>
<td>29</td>
<td>30</td>
<td>31</td>
<td class="pad" colspan="3"> </td>
</tr>
</tbody>
我正在使用Eclipse与selenium和Testng。我需要这样的东西:
public void countDaywithPosts()
{
List<WebElement> componentes = null;
for(int n = 0; n < 5; n++)
{
for(int j = 0; j <7; j++)
componentes = calendar.findElements(By.xpath("//*[@id='wp-calendar']/tbody/tr["+n+"]/td["+j+"]"));
}
WebElement pepito = componentes.get(0);
}