mardi 7 mars 2017

How to use splinter to fill up an input box inside a table?

I have a html structure as following:

    <table id="Table1" style="Z-INDEX: 101; LEFT: 52px; WIDTH: 407px; POSITION: absolute; TOP: 53px" width="407" cellspacing="1" cellpadding="1" border="0">
                <tbody><tr>
                    <td style="WIDTH: 102px"></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td style="WIDTH: 102px">Email</td>
                    <td>
                        <input name="TextBox1" id="TextBox1" style="width:153px;" type="text"></td>
                    <td></td>
                </tr>
                <tr>
                    <td style="WIDTH: 102px">Password</td>
                    <td>
                        <input name="TextBox2" id="TextBox2" style="width:153px;" type="password"></td>
                    <td>
                        <input name="Button1" value="Login" id="Button1" style="width:68px;" type="submit"></td>
                </tr>
                <tr>
                    <td style="WIDTH: 102px"></td>
                    <td> </td>
                    <td></td>
                </tr>
                <tr>
                    <td style="WIDTH: 102px; height: 20px;"><a href="signinup.aspx">Sign up</a></td>
                    <td style="height: 20px">
                        <a href="changepassword.aspx">Change Password</a></td>
                    <td style="height: 20px"><a href="RetrievePassword.aspx">Retrieve Password</a></td>
                </tr>
                <tr>
                    <td style="WIDTH: 102px"></td>
                    <td> </td>
                    <td></td>
                </tr>
            </tbody>
         </table>

I would like to access the input box having ID TextBox1 and TextBox2.

I am doing following (for example):

browser.fill('TextBox1', 'John')

But it returns me with an error:

splinter.exceptions.ElementDoesNotExist: no elements could be found with name "TextBox1"

Can anyone help on this? (I am using splinter for the first time)

Aucun commentaire:

Enregistrer un commentaire