| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1169 人关注过本帖
标题:C#实现163邮箱的自动登录时遇到了问题,请高人赐教啊!
只看楼主 加入收藏
雨夜星光
Rank: 4
等 级:业余侠客
帖 子:66
专家分:230
注 册:2009-11-25
结帖率:85.71%
收藏
 问题点数:0 回复次数:1 
C#实现163邮箱的自动登录时遇到了问题,请高人赐教啊!

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                SHDocVw.InternetExplorer IE = new InternetExplorer();
                IE.Visible = true;
                string URL = "http://mail.
                object nullArg = null;
                IE.Navigate(URL, ref nullArg, ref nullArg, ref nullArg, ref nullArg);
                System.Threading.Thread.Sleep(1000);
                //得到IE的文档对象模型
                mshtml.IHTMLDocument2 DOM = (mshtml.IHTMLDocument2)IE.Document;
                //声明用户名
                mshtml.IHTMLInputTextElement txtUserName = (mshtml.IHTMLInputTextElement)DOM.all.item("username", null);
                txtUserName.value = "weijiezhang";
                //声明密码
                mshtml.IHTMLInputTextElement txtPwd = (mshtml.IHTMLInputTextElement)DOM.all.item("Password", null);
                txtPwd.value = "wj310791";
                //声明登录               
                mshtml.HTMLInputButtonElement btnLogin = (mshtml.HTMLInputButtonElement)DOM.all.item("null",0);
                System.Threading.Thread.Sleep(1000);               
                btnLogin.click();
               
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

其中
               //声明登录               
                mshtml.HTMLInputButtonElement btnLogin = (mshtml.HTMLInputButtonElement)DOM.all.item("null",0);
                System.Threading.Thread.Sleep(1000);               
                btnLogin.click();
,在btnlogin.click()处出现异常,“没有实例化对象”,请问该如何解决?

搜索更多相关主题的帖子: 登录 自动 163邮箱 高人 
2010-03-30 14:19
jockey
Rank: 3Rank: 3
等 级:论坛游民
威 望:8
帖 子:977
专家分:52
注 册:2005-12-4
收藏
得分:0 
mshtml.HTMLInputButtonElement btnLogin = (mshtml.HTMLInputButtonElement)DOM.all.item("null",0);
 你要分析网站源码,那个按钮名字肯定不是null!

2012-06-28 11:27
快速回复:C#实现163邮箱的自动登录时遇到了问题,请高人赐教啊!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026331 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved