mardi 8 août 2017

PhantomJs enable checkboxes

I have a webpage having multiple tables with check boxes. On UI, onclick of a button all the checkboxes are enabled. I want to automate this process using phantomjs.

I tried clicking the button from phantomjs - it does click but does not enable check boxes. I tried enabling single checkbox. But it did not enable. Is it unable to find selectAll()? Is there anyway to debug phantomjs.

 function () {
    page.evaluate(function () {
        if ($("id_SelectAllButton").click())
        {
            if (!this.checked)
            {
                document.getElementById("id_checkbox1").disabled = false;
            }                            
        }


    });
 }

 <div class='Section1'>
 <h3>Section 1</h3>
 <table width='90%'>
    <tr>
        <td colspan='4'>&nbsp;&nbsp;&nbsp;&nbsp;<input id = 'id_SelectAllButton' type='button' value='SelectAll' onclick='selectAll(this.parentElement)'/></td>
    </tr>
    <tr>
        <td></td>
        <td class='b'>Name</td>
        <td class='b'>DOB</td>
        <td class='b'>Rank</td>
    </tr>
    <tr>
        <td><input id='id_checkbox1' type='checkbox'></td>
        <td>Abc</td>
        <td>01/01/0001</td>
        <td>2</td>
    </tr>
 </table>
</div>

I really appreciate your help!




Aucun commentaire:

Enregistrer un commentaire