delphi的webbrowser操作网页,自动登录后怎么继续在登进去的页面再次操作网页?
procedureTForm1.btnLoginClick(Sender:TObject);varUserEdt,UserPwd,LogBtn:IHTMLELEMENT;...
procedure TForm1.btnLoginClick(Sender: TObject);
var
UserEdt, UserPwd, LogBtn: IHTMLELEMENT;
begin
WebBrowser.Navigate(edtUrl.Text);
while WebBrowser.busy do
Application.ProcessMessages;
while WebBrowser.ReadyState <>READYSTATE_COMPLETE do
Application.ProcessMessages;
//具体的用户名,密码,登录按钮的名称,根据登录页面表单而定
UserEdt := (WebBrowser.Document as IHTMLDOCUMENT2).all.item('userid',emptyParam) as IHTMLELEMENT;
UserPwd := (WebBrowser.Document as IHTMLDOCUMENT2).all.item('pwd',emptyParam) as IHTMLELEMENT;
LogBtn := (WebBrowser.Document as IHTMLDOCUMENT2).all.item('submit',emptyParam) as IHTMLELEMENT;
UserEdt.setAttribute('value', edtUserName.Text,0);
UserPwd.setAttribute('value', edtPassword.Text,0);
LogBtn.Click;
end;
部分源码如上,执行 LogBtn.Click;将自动登录,成功登录进去后要怎么继续操作网页 展开
var
UserEdt, UserPwd, LogBtn: IHTMLELEMENT;
begin
WebBrowser.Navigate(edtUrl.Text);
while WebBrowser.busy do
Application.ProcessMessages;
while WebBrowser.ReadyState <>READYSTATE_COMPLETE do
Application.ProcessMessages;
//具体的用户名,密码,登录按钮的名称,根据登录页面表单而定
UserEdt := (WebBrowser.Document as IHTMLDOCUMENT2).all.item('userid',emptyParam) as IHTMLELEMENT;
UserPwd := (WebBrowser.Document as IHTMLDOCUMENT2).all.item('pwd',emptyParam) as IHTMLELEMENT;
LogBtn := (WebBrowser.Document as IHTMLDOCUMENT2).all.item('submit',emptyParam) as IHTMLELEMENT;
UserEdt.setAttribute('value', edtUserName.Text,0);
UserPwd.setAttribute('value', edtPassword.Text,0);
LogBtn.Click;
end;
部分源码如上,执行 LogBtn.Click;将自动登录,成功登录进去后要怎么继续操作网页 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询