【发布时间】:2018-02-01 23:32:22
【问题描述】:
我开始学习机器人框架并编写简单的 UI 测试用例以使用 chrome 浏览器登录 jenkins。这是我的机器人代码。
Enter User Name
Input Text name=j_username ${Username}
Enter Password
Input Text name=j_password ${Password}
Click Login
click button submit-button
我能够从源代码中获取 j_username 和 j_password,但不知何故我无法为单击按钮找到正确的定位器。这是html代码
class="clear">
<div id="side-panel"></div>
<div id="main-panel">
<a name="skip2content"></a>
<div style="margin: 2em;">
<form method="post" name="login" action="j_acegi_security_check" style="text-size:smaller">
<table>
<tr>
<td>User:</td>
<td>
<input type="text" name="j_username" id="j_username" autocorrect="off" autocapitalize="off" /></td>
</tr>
<tr>
<td>Password:</td>
<td>
<input type="password" name="j_password" /></td>
</tr>
<tr>
<td align="right">
<input id="remember_me" type="checkbox" name="remember_me" /></td>
<td><label for="remember_me">Remember me on this computer</label></td>
</tr>
</table>
<input name="from" type="hidden" value="/" />
<input name="Submit" type="submit" value="log in" class="submit-button primary" />
<script>
我试过name=submit value=log in,但没有成功
【问题讨论】:
-
html 代码:
用户: 密码: -
请修正您的问题以包含正确标记的 html 代码,以便我们阅读。我已经修复了机器人代码,但修复 html 对我来说太耗时了。
-
当你说“但没有运气”时,这是什么意思?你有错误吗?它是否单击了错误的按钮?脚本会崩溃吗?
标签: robotframework