窗体上放一个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. 利用 apache ab 测试服务器性能

    安装步骤:https://blog.csdn.net/ahaaaaa/article/details/51514175 在Windows系统下,打开cmd命令行窗口,定位到apache安装目录的bin ...

  2. Android Design Support Library概览

    尊重劳动成果.转载请注明出处:http://blog.csdn.net/growth58/article/details/47972467 关注新浪微博:@于卫国 邮箱:yuweiguocn@gmai ...

  3. Nginx优化指南+LINUX内核优化+linux连接数优化+nginx连接数优化

    Most setup guides for Nginx tell you the basics - apt-get a package, modify a few lines here and the ...

  4. Cocos2d-X中的粒子

    Cocos2d-x引擎提供了强大的type=cocos2d-x&url=/doc/cocos-docs-master/manual/framework/native/v3/particle-s ...

  5. Cadence SPB 16. 6 安装步骤

    1.首先下载Cadence Allegro SPB orCAD16. 6 安装包,单击我,下载之后运行其中的setup.exe,然后先安装第一项License Manager

  6. 数据仓库建模与ETL的实践技巧(转载)

    一.Data仓库的架构 Data仓库(Data Warehouse DW)是为了便于多维分析和多角度展现而将Data按特定的模式进行存储所建立起来的关系型Datcbase,它的Data基于OLTP源S ...

  7. 多媒体开发之---h.264 SPS PPS解析源代码,C实现一以及nal分析器

    http://blog.csdn.net/mantis_1984/article/details/9465909 http://blog.csdn.net/arau_sh/article/detail ...

  8. ComboBox在WPF中的绑定示例:绑定项、集合、转换,及其源代码

    示例1.Selector(基类) 的示例Controls/SelectionControl/SelectorDemo.xaml <Page x:Class="Windows10.Con ...

  9. EasyIPCamera实现的桌面采集直播用于课堂、会议、展销同屏等应用

    本文转自博客:http://blog.csdn.net/jinlong0603/article/details/56664233 Android同屏直播 在Android上除了获取摄像头数据为Easy ...

  10. EasyDarwin开源流媒体服务器进行RTSP转发过程中将sdp由文件存储改成内存索引

    -本篇由团队成员Fantasy供稿! 原始版本 在Darwin Streaming Server版本中,推送端DoAnnounce的时候后服务器会根据easydarwin.xml中配置的movies_ ...