【发布时间】:2015-03-09 14:07:43
【问题描述】:
所有,我们有一个基于网络的 RFID 应用程序。我们正在尝试在我们的设施中制作展示信息的展示板。我正在尝试使网页自动登录,但我没有任何运气。我已经尝试枚举页面上的所有标签/元素,但我没有任何运气。
访问冲突与下面的行(因为元素 j_username 未找到,但它显然在 html sn-p 中。我知道我遗漏了一些简单的东西。有人可以帮忙吗?
WebBrowser1.OleObject.Document.GetElementByID('j_username').
setAttribute('value', 'dempseyw');
这是我试图自动化的页面的登录代码。
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>MobileView</title>
<style type="text/css">
.loginTextCss{
padding:0 0 0 22;
}
#javax_faces_developmentstage_messages{
display: none;
}
</style></head><body onload="document.getElementById('j_username').focus()" style="margin:0px; overflow: hidden;">
<div style="display:none" id="notLogedInMarker"></div>
<form action="http://dmh-rfidweb/asset-manager-web/j_spring_security_check" method="post">
<table border="0" align="center" height="100%" width="687" cellpadding="0" cellspacing="0">
<tr>
<td height="50%" valign="top">
<img src="http://dmh-rfidweb/asset-manager-web/images/spacer.gif" border="0" width="1" height="1" />
</td>
</tr>
<tr>
<td class="directionCss"><span style="font-size:12px; font-weight: bold; color: #0000FF; font-family:arial"></span>
</td>
</tr>
<tr>
<td height="427" valign="top" background="http://dmh-rfidweb/asset-manager-web/images/branding/healthcare/bg_login.jpg" style="background-repeat:no-repeat; color:#000000; font-family:arial, Helvetica, sans-serif; font-size:14px;">
<div style="width:200px;height:150px;float:right;">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="padding:3 6 0 22;" valign="bottom">
<br clear="all" />
<a href="https://www.stanleyhealthcare.com/" target="new"><img src="http://dmh-rfidweb/asset-manager-web/images/branding/healthcare/logo_mobileview.gif" style="border:1; hspace:2;" />
</a>
</td>
</tr>
</table>
</div>
<br clear="all" />
<div style="height:50; padding:0 0 0 15;">
<div style="height:10;"></div>
</div>
<div class="loginTextCss"><label for="j_username">User Name:</label>
<br /><input id="j_username" name="j_username" type="text" value="" style="font-size:16px; width:170px;" />
<br />
<br /><label for="j_password">Password:</label>
<br /><input type="password" id="j_password" name="j_password" value="" style="font-size:16px; width:170px;" />
<br />
<div style="font-size:11;">
<input id="rememberMe" type="checkbox" name="_spring_security_remember_me" title="Remember me on this computer" checked="Checked" />
<label for="rememberMe" title="Remember me on this computer">Remember me on this computer</label>
</div>
<div style="padding-left:112px;padding-top:20;">
<input type="submit" value="Log In" style="padding:3 10 3 10;color:#000000; font-family:arial, Helvetica, sans-serif;font-size:14px;" />
</div>
</div>
</td>
</tr>
<tr>
<td height="50%" valign="top">
<img src="http://dmh-rfidweb/asset-manager-web/images/spacer.gif" border="0" width="1" height="1" />
</td>
</tr>
</table>
</form></body>
</html>
【问题讨论】:
-
而不是访问 UI 元素发出 POST 请求。
标签: html delphi getelementbyid twebbrowser