mercredi 2 décembre 2015

CasperJS to select a checkbox with specified text

I want to use casperJS to automatically select a checkbox

<tr>
    <td style=" text-align:center;">
        <input type="checkbox" data-rowindex="1" data-crdid="0005442" data-numcrd="3" value="">
    </td>
    <td>Data Structures and Algorithms</td>
    <td>INT2203></td>
</tr>
<tr>
    <td style=" text-align:center;">
        <input type="checkbox" data-rowindex="2" data-crdid="0005682" data-numcrd="3" value="">
    </td>
    <td>Machine Learning</td>
    <td>INT2204></td>
</tr>
<tr>
    <td style=" text-align:center;">
        <input type="checkbox" data-rowindex="3" data-crdid="003643" data-numcrd="3" value="">
    </td>
    <td>Artificial Intelligence</td>
    <td>INT2205></td>
</tr>

The first column is the checkbox to select. The second one is the name of the subject and the last one is the ID of the subject.

Now I just know the ID of the subject: INT2204 and I want to use casperjs to select the box of this subject. However, the only thing to distinguish is data-crdid which I have no clue.

Are there anyway to select the checkbox of the subject with ID 'INT2204' by casperjs?




Aucun commentaire:

Enregistrer un commentaire