Windows应用程序打开网站登录按钮 [英] windows application to open website login button

查看:71
本文介绍了Windows应用程序打开网站登录按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Windows窗体应用程序打开网站登录.

I want to open website login using windows form application.

推荐答案

您正在谈论网站自动化.如果Windows窗体中包含Web浏览器控件,则可以非常轻松地执行网站操作(即,单击按钮,阅读文本框).

这是一个很好的参考站点,提供了更多详细信息:
http://social.msdn.microsoft.com/论坛/en-US/vbgeneral/thread/23dfc3f9-3274-4929-8dc5-9ba543f4911d [
You are talking about website automation. If your windows forms has a web browser control in it you could do website actions (i.e. button clicks, read textboxes) quite easily.

Here is a good reference site for more detail:
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/23dfc3f9-3274-4929-8dc5-9ba543f4911d[^]


创建Windows应用程序

添加WebBrowser控件
编写代码以浏览网站
Create a Windows Application

Add WebBrowser Control
Write Code to Navigate Site
public bool isrun;
        private void Form1_Load(object sender, EventArgs e)
        {
            webBrowser1.Url = new Uri("http://www.yourwebsite.com");
        }



在此之后添加一个事件DocumentCompleted
页面完全加载时发生的情况



after this add a event DocumentCompleted
which occurs where page completely loaded

        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
        if(!isrun)
        {
            webBrowser1.Document.GetElementById("login_name").InnerText = "uid";
            webBrowser1.Document.GetElementById("passwd").InnerText = "pwd";
            webBrowser1.Document.GetElementById("buttonid_login").InvokeMember("click");      
           isrun=true;
        }

}


您应该在Windows应用程序中使用Web浏览器控件
谢谢
You should use Web Browser Control In Windows Application
Thanks


这篇关于Windows应用程序打开网站登录按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆