用这样一个方法输入数字(识别出来的验证码)并模拟点击"继续浏览"按钮..
以前还可以模拟点击的..现在不行了..(那个页面的代码跟以前没什么变化啊,只是按钮的位置变了下,应该没影响的啊)
var
input:OleVariant;
Doc:IHTMLDocument2;
ihtext:ihtmlinputelement;
begin
doc:=webbrowser1.document as ihtmldocument2;
ihtext:=(doc.all.item('userValidateCode',0) as ihtmlinputelement);
ihtext.value:=codenum;
input:=doc.all.item('submit',0);
input.click;
end;网页HTML代码:
<form action="/validateuser.do" method="post" name="valiateUserForm">
<div class="attention"><p>刚刚你看了100个同学的页面,谢谢你对校内网的支持。<br /><strong>输入验证码</strong>,再接再厉:)</p></div>
<div class="optional"><input type="hidden" name="id" value="24630830"/>
<label for="personalInfo5qValidateCode">验证码:</label><input type="text" name="userValidateCode" id="userValidateCode" class="inputtext" size="10" maxlength="10" tabindex="1"/><img src="RandImageServlet?post=uservalidate221870487&rnd=1181032086036"/>
</div><div class="actions" style="margin:10px auto">
<input type="submit" name="submit" tabindex="7" value="继续浏览" id="submit" class="subbutton" />
---------------
有什么替代的方法吗?用form.submit试过也没用...

解决方案 »

  1.   

    http://blog.csdn.net/sdzeng/archive/2006/03/23/636352.aspx
      

  2.   

    re :sdzeng(大头鸟)
    这个...我试过了..不行...
      

  3.   

    IHTMLInputButtonElement可以的
    ////////////////////////////////////////////////////////
    var
        ShellWindow: IShellWindows;
        ie :IWebBrowser2;
        i,j : Integer;
        V,vInput : OleVariant;
        sp:IDispatch;
        idoc:IHTMLDocument2;
        aInput :IHTMLInputButtonElement;
    begin
        ShellWindow := CoShellWindows.Create;
        for i:=0 to ShellWindow.Count-1 do
        begin
           V := i;
           sp := ShellWindow.Item(V);
           sp.QueryInterface(IWebBrowser2,ie);
           if ie<>nil then
           begin
            if ie.LocationURL='file:///E:/a.html'  then
            begin
                ie.Document.QueryInterface(IHTMLDocument2,idoc);
                if idoc<>nil then
                begin
                    for j:=0 to idoc.all.Length-1 do
                    begin
                        sp := idoc.all.item(j,varEmpty);
                        if SUCCEEDED(sp.QueryInterface(IHTMLInputButtonElement,aInput)) then
                        begin
                         if aInput.value='继续浏览' then
                         begin
                            vInput := aInput;
                            vInput.Click;
                            Break;
                         end;
                        end;
                    end;
                end;
                Break;
            end;
           end;
        end;
    end;
      

  4.   

    id=221870487&userValidateCode=0830&submit=%E7%BB%A7%E7%BB%AD%E6%B5%8F%E8%A7%
    这个是我用wsockexpert抓到的..但是直接在浏览器上提交没用,显示的还是validateuser.do的页面...
    用webbrowser1.Navigate('validateuser.do?id=222114967&userValidateCode=0000&submit=%E7%BB%A7%E7%BB%AD%E6%B5%8F%E8%A7%88')也没用...那正确的POST数据应该怎么做啊?