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 and fill them up with username and password.
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)
As you mention in your comments, the problem stems from the frame that the box is wrapped in. Get around it like this:
browser.visit(browser.find_by_tag('frame')[0]['src'])
browser.fill('TextBox1', 'John')