打印本文 打印本文 关闭窗口 关闭窗口
报名机器人
作者:武汉SEO闵涛  文章来源:敏韬网  点击数3692  更新时间:2009/4/23 18:34:21  文章录入:mintao  责任编辑:mintao
:= 1 to placeNum do

       begin

              places[i] := Nentry.ChildNodes[i-1].NodeValue;

              placesID[i] := strtoint(Nentry.ChildNodes[i-1].NodeValue);

       end;

end;

用读入的数据填写第一步的表单。

表格 2

procedure TfrmMain.FillForm1;

var

     idInput:IHTMLInputElement;

    pinInput:IHTMLInputElement;

 

     doc: ihtmldocument2;

begin

 

        doc:=(WebBrowser1.Document as IHTMLDocument2);

        idInput := (doc.all.item(''''user_name'''',0) as IHTMLInputElement) ;

        idInput.value := id;

 

        pinInput := (doc.all.item(''''pin'''',0) as IHTMLInputElement) ;

        pinInput.value := pwd;

end;

注意填表单的时机,是在页面下载完毕以后,由webbrowser的DocumentComplete事件触发填完表单后马上模拟点击Submit按钮,进入第二步。

表格 3

procedure TfrmMain.WebBrowser1DocumentComplete(Sender: TObject;

  const pDisp: IDispatch; var URL: OleVariant);

var

    kk:hwnd;

    obj:OleVariant;

    doc: ihtmldocument2;

begin

    if (stage = 0) then //第一步

    begin

        FillForm1;    //填表单1

        stage := stage +1;

 

        doc:=(WebBrowser1.Document as IHTMLDocument2);

 

        obj:=doc.all.item(''''Submit'''',0);

        obj.click;    //点“下一步”按钮

        statusBar1.Panels[0].Text := ''''正在打开报名协议页面。。。'''';

    end

    else if (stage = 1)  then   //第二步

    begin

        //showmessage(inttostr(stage) + ''''  WebBrowser1DocumentComplete'''');

        doc:=(WebBrowser1.Document as IHTMLDocument2);

 

        obj:=doc.all.item(''''Agree'''',0);

        obj.click;

        stage := stage +1;

 

    end

    else if (stage = 2) then   //第三步

    begin

         FillForm2;  //填表单2

         TryAgain;  //报名一次

         timer1.Enabled := true;

         timer1.Interval := strtoint(edtInterval.Text) * 1000;

         stage := stage +1;

         statusBar1.Panels[0].Text := ''''正在报名。。。'''';

    end  &

上一页  [1] [2] [3] [4]  下一页

打印本文 打印本文 关闭窗口 关闭窗口