http://member1.taobao.com/member/login.jhtml
这个页面的密码框我试了很多种方法都填不上东西,但我看到别人有用软件自动填写的,不知道要怎么做

解决方案 »

  1.   


    procedure TForm1.Button1Click(Sender: TObject);
    var
      Doc:IHTMLDocument2;
      Submit:IHTMLElement;
      TPL_UserName:IHTMLInputElement;
      PasswordObj:IHTMLObjectElement;
      V:OleVariant;
    begin
      WebBrowser1.Navigate('http://member1.taobao.com/member/login.jhtml');
      while WebBrowser1.ReadyState<>4 do
        Application.ProcessMessages;
      //
      Doc:=WebBrowser1.Document as IHTMLDocument2;
      TPL_UserName:=Doc.all.item('TPL_username',varEmpty) as IHTMLInputElement;
      TPL_UserName.value:='淘宝用户名';
      //
      PasswordObj:=Doc.all.item('Password_Edit',varEmpty) as IHTMLObjectElement;
      V:=PasswordObj.object_;
      V.TextData:='';//TPL_password,这里是加密后的密码,具体怎么加密,看网页中的ActiveX,如果您还不会,加分,我帮你搞定
      Submit:=Doc.all.item('Submit',varEmpty) as IHTMLElement;
      Submit.click;
    end;
      

  2.   

    不用加分了,答案在此uses
       SHDocVw, MSHTML, OleCtrls;procedure Taobao_Login(Browser: TWebBrowser;UserName,Password:string);
    var
      Doc:IHTMLDocument2;
      PasswordObj:IHTMLObjectElement;
      V:OleVariant;
    begin
      Browser.Navigate('http://member1.taobao.com/member/login.jhtml');
      while Browser.ReadyState<>4 do
        Application.ProcessMessages;
      Doc:=Browser.Document as IHTMLDocument2;
      (Doc.all.item('TPL_username',varEmpty) as IHTMLInputElement).value:=UserName;
      PasswordObj:=Doc.all.item('Password_Edit',varEmpty) as IHTMLObjectElement;
      V:=PasswordObj.object_;
      v.PasswordMode:=True;
      v.SecurityMode:=False;
      V.TextData:=Password;
      (Doc.all.item('Submit',varEmpty) as IHTMLElement).Click;
    end;
      

  3.   

    TO:hidelphi 
    我试了你的代码,密码是base64加密的吧,我写上后,测试时总显示缺少密码,是不是密码没有自动添加进去呢
      

  4.   

    加密方式好像不是Base64,可能是DES,而且返回的是16进制的,如果密码是aa,那么TextData的值就是:3DES_2_000000000000000000000000000000_5B91551144E78DA7我告诉你个方法,先在密码框输入正确密码,看看你的密码的TextData是多少:procedure TForm1.Button3Click(Sender: TObject);
    var
      PasswordObj:IHTMLObjectElement;
      V:OleVariant;
    begin
      PasswordObj:=(WebBrowser1.Document as IHTMLDocument2).all.item('Password_Edit',varEmpty) as IHTMLObjectElement;
      V:=PasswordObj.object_;
      ShowMessage(V.TextData);
    end;然后把TextData值给6楼的代码,可以登录的
    还有个方法就是用截包软件查看发送的HTTP数据,也可以看到TextData的值。这个TextData如何用明文的方式赋值上去,本人还真搞不定,大侠出来分享
      

  5.   

    淘宝密码输入框的接口定义:  IEditCtrl = interface(IDispatch)
        ['{F657EB90-FBE0-41A1-9E98-45D784929FB5}']
        function Get_PasswordMode: WordBool; safecall;
        procedure Set_PasswordMode(pVal: WordBool); safecall;
        function Get_SecurityMode: WordBool; safecall;
        procedure Set_SecurityMode(pVal: WordBool); safecall;
        function Get_TextValue: WideString; safecall;
        procedure Set_TextValue(const pVal: WideString); safecall;
        function Get_MaxLength: LongWord; safecall;
        procedure Set_MaxLength(pVal: LongWord); safecall;
        function Get_LogMode: WordBool; safecall;
        procedure Set_LogMode(pVal: WordBool); safecall;
        function Get_TextData: WideString; safecall;
        procedure Set_TextData(const pVal: WideString); safecall;
        function EchoTest: WordBool; safecall;
        function Get_Readonly: WordBool; safecall;
        procedure Set_Readonly(pVal: WordBool); safecall;
        function Get_MACAddress: WideString; safecall;
        function Crypto(bEncrypt: WordBool; nIndex: LongWord; const pInput: WideString): WideString; safecall;
        function Get_CryptoMode: Word; safecall;
        procedure Set_CryptoMode(pVal: Word); safecall;
        function Get_Intension: LongWord; safecall;
        function Get_Identity: WideString; safecall;
        function Get_UseP: WordBool; safecall;
        function Get_PInfo: WideString; safecall;
        function ci1: WideString; safecall;
        function ci2: WideString; safecall;
        function ci3: WideString; safecall;
        procedure Set_cm5ts(const pVal: WideString); safecall;
        function Get_cm5ts: WideString; safecall;
        procedure Set_cm5pk(const pVal: WideString); safecall;
        function Get_cm5pk: WideString; safecall;
        property PasswordMode: WordBool read Get_PasswordMode write Set_PasswordMode;
        property SecurityMode: WordBool read Get_SecurityMode write Set_SecurityMode;
        property TextValue: WideString read Get_TextValue write Set_TextValue;
        property MaxLength: LongWord read Get_MaxLength write Set_MaxLength;
        property LogMode: WordBool read Get_LogMode write Set_LogMode;
        property TextData: WideString read Get_TextData write Set_TextData;
        property Readonly: WordBool read Get_Readonly write Set_Readonly;
        property MACAddress: WideString read Get_MACAddress;
        property CryptoMode: Word read Get_CryptoMode write Set_CryptoMode;
        property Intension: LongWord read Get_Intension;
        property Identity: WideString read Get_Identity;
        property UseP: WordBool read Get_UseP;
        property PInfo: WideString read Get_PInfo;
        property cm5ts: WideString read Get_cm5ts write Set_cm5ts;
        property cm5pk: WideString read Get_cm5pk write Set_cm5pk;
      end;
      

  6.   

    如果能把光标放在密码框上的话,能不能用发送按键的方式写上去呢
    如果放不到密码框上,放到用户名框上,再发送个tab键,也是可以移到密码框上的,但是光标怎么控制我不会
      

  7.   

    这个也麻烦,如果你有很多账户要登录的,建议,全部自己输入第一遍,然后记下TextData保存,下次不就OK了
      

  8.   

    那这样子好了,软件使用第一次,需要手动的去输入密码,你把淘宝的密码框单独的在WebBroswer中显示,以后就无需在输入密码了
      

  9.   

    v.SecurityMode:=False;
    加这一句就可以了。我都自己试过可以了。楼主还唧唧歪歪啰啰嗦嗦。真烦。
      

  10.   

    真的要学习啊,正好帮我解决了问题。tks
      

  11.   


    如果想调用这个接口里的函数如:crypto 、gevaluetext等返回为空为什么?有什么方法解决吗?