我有一个HTML结构如下:如何使用分裂填充表格内的输入框?
<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>
我想访问具有ID TextBox1的1和TextBox输入框并填满他们的用户名和密码。
我做以下(举例):
browser.fill('TextBox1', 'John')
但它返回我一个错误:
splinter.exceptions.ElementDoesNotExist: no elements could be found with name "TextBox1"
任何人都可以在这方面的帮助? (我使用的分裂首次)
它的工作原理!添加完整的例子,所以我们可以帮助 –
@PiotrDawidiuk我添加了完整的例子,让我知道缺少什么? – MiNdFrEaK
我重新创建了这个案例,它的工作原理。试试这个:http://pastebin.com/WDUjgzvL(/home/x/example.html是你发布的HTML)。它将填写表格。所以我想你在其他地方有一个错误,这就是为什么我需要更多的细节。 –