窗体上放一个WebBrowser,其Url属性设置为http://www.alimama.com/membersvc/member/login.htm,其他属性为默认

再放一个Button,默认

Button按钮的代码如下(方法一)

view plaincopy to clipboardprint?
private void button1_Click( object sender, EventArgs e )   
{   
    System.Windows.Forms.HtmlDocument document =this.webBrowser1.Document;   
    if ( document == null )   
    {   
        return;   
    }   
    document.All["logname"].SetAttribute( "Value", "用户名" );            //用户名   
    document.All["originalLogpasswd"].SetAttribute( "Value", "密码" );      //密码   
    document.All["dologin"].InvokeMember( "click" );    //登录按钮的click方法         
}  
        private void button1_Click( object sender, EventArgs e )
        {
            System.Windows.Forms.HtmlDocument document =this.webBrowser1.Document;
            if ( document == null )
            {
                return;
            }
            document.All["logname"].SetAttribute( "Value", "用户名" );            //用户名
            document.All["originalLogpasswd"].SetAttribute( "Value", "密码" );      //密码
            document.All["dologin"].InvokeMember( "click" );    //登录按钮的click方法      
        }

方法二

view plaincopy to clipboardprint?
private void button1_Click( object sender, EventArgs e )   
{   
    System.Windows.Forms.HtmlDocument document =this.webBrowser1.Document;   
    if ( document == null )   
    {   
        return;   
    }   
    document.All["logname"].SetAttribute( "Value", "用户名" );            //用户名   
    document.All["originalLogpasswd"].SetAttribute( "Value", "密码" );      //密码   
  
    document.All["dologin"].RaiseEvent( "onClick" );        //登录按钮的click事件   
    document.All["formRegStep1Main"].InvokeMember( "submit" );  //提交表单   
}  
        private void button1_Click( object sender, EventArgs e )
        {
            System.Windows.Forms.HtmlDocument document =this.webBrowser1.Document;
            if ( document == null )
            {
                return;
            }
            document.All["logname"].SetAttribute( "Value", "用户名" );            //用户名
            document.All["originalLogpasswd"].SetAttribute( "Value", "密码" );      //密码
      
            document.All["dologin"].RaiseEvent( "onClick" );        //登录按钮的click事件
            document.All["formRegStep1Main"].InvokeMember( "submit" );  //提交表单
        }

测试环境:WinXp(SP2)、VS2008用

转自sdfkfkd

使用WebBrowser自动登录阿里妈妈网站的更多相关文章

  1. 开发Chrome插件,实现网站自动登录

    近期被一个事情困扰着,我们采购了一款软件,里面有一个数据大屏页,当登录过期后,数据就会保持原状,不再更新.和供应商反馈了很多次,都无法彻底解决数据显示的问题,没办法,自己周末在家研究,网站自动登录的事 ...

  2. iconfont阿里妈妈前端小图标使用方法详解

    图标选购网址:http://www.iconfont.cn/ 1.从阿里妈妈网站选购好小图标,加入购物车,下载好文件: 2.把字体文件放入字体(font)文件夹(tff)(woff),(eot) 3. ...

  3. C#_自动化测试1_模拟post,get_12306火车票网站自动登录工具

    还记得2011年春运,12306火车票预订网站经常崩溃无法登录吗. 今天我们就开发一个12306网站自动登录软件. 帮助您轻松订票 通过前两篇博客Fiddler教程和HTTP协议详解,我们了解了Web ...

  4. delphi webbrowser post自动登录

    delphi webbrowser post自动登录     var  EncodedDataString: WideString;  PostData: OleVariant;  Headers: ...

  5. python网络爬虫之使用scrapy自动登录网站

    前面曾经介绍过requests实现自动登录的方法.这里介绍下使用scrapy如何实现自动登录.还是以csdn网站为例. Scrapy使用FormRequest来登录并递交数据给服务器.只是带有额外的f ...

  6. 12306.cn网站自动登录器源代码

    去年过年放假的时候写了一个12306.cn网站的自动登录器,刚好那时候放假了,所以没把源代码放出来,现在将代码发出来,由于编写得比较仓促(从放假的下午19:00左右到晚上到00:00左右),很多细节问 ...

  7. Java 扫描微信公众号二维码,关注并自动登录网站

    https://blog.csdn.net/qq_42851002/article/details/81327770 场景:用户扫描微信公众号的二维码,关注后自动登录网站,若已关注则直接登录. 逻辑: ...

  8. 吴裕雄--天生自然PYTHON学习笔记:python自动登录网站

    打开 www. 5 l eta . com 网站,如果己经通过某用户名进行了登录,那么先退出登录 . 登录该网站 的步骤一般如下 : ( 1 )单击右上角的“登录”按钮. ( 2 )先输入账号. ( ...

  9. python模拟自动登录网站(urllib2)

    不登录打开网页: import urllib2 request = urllib2.Request('http://www.baidu.com') response = urllib2.urlopen ...

随机推荐

  1. cache数据库之表的存储结构

    1.我们已经建了一个person类,接下来就是表的存储结构 2.打开Inspector,先输入rowid名字为p_RowID,选class->Storage 3.新建一个Storage,选择Ca ...

  2. SQL中Inserted 和Deleted表 以及触发Trigger

    什么是Inserted 和Deleted表 他们有什么用 trigger 的简单实用 1.什么是Inserted 和Deleted表 当插入数据的时候,其实是同时向目的表 和inserted表中插入数 ...

  3. LeetCode 第 3 题(Longest Substring Without Repeating Characters)

    LeetCode 第 3 题(Longest Substring Without Repeating Characters) Given a string, find the length of th ...

  4. sql quer

    SELECT (SELECT COUNT (sysid) FROM FwInvConsumable WHERE parentref = g.sysid AND (ns.state = 'Invento ...

  5. Linux Setuid(SUID)和Setgid(SGID) sticky bit

    http://www.php100.com/html/webkaifa/Linux/2010/0812/6392.html 1.setuid和setgid的解说 setuid和setgid位是让普通用 ...

  6. How to reset your password in Ubuntu

    There are many reasons you might want to reset a password: Someone gave you a computer with Ubuntu i ...

  7. 微信热补丁 Tinker 的实践演进之路

    http://dev.qq.com/topic/57ad7a70eaed47bb2699e68e http://dev.qq.com/topic/57a30878ac3a1fb613dd40eb ht ...

  8. 系统安全-LDAP

    LDAP服务器 1.目录服务  目录是一个为查询.浏览和搜索而优化的专业分布式数据库,它呈树状结构组织数据,就好像Linux/Unix系统中的文件目录一样.目录数据库和关系数据库不同,它有优异的读性能 ...

  9. Django+uwsgi+nginx+angular.js项目部署

    这次部署的前后端分离的项目: 前端采用angular.js,后端采用Django(restframework),他俩之间主要以json数据作为交互 Django+uwsgi的配置可以参考我之前的博客: ...

  10. 宜信开源|分布式任务调度平台SIA-TASK的架构设计与运行流程

    一.分布式任务调度的背景 无论是互联网应用或者企业级应用,都充斥着大量的批处理任务.我们常常需要一些任务调度系统来帮助解决问题.随着微服务化架构的逐步演进,单体架构逐渐演变为分布式.微服务架构.在此背 ...