使用WebBrowser控件以编程方式登录到网站时出现问题 [英] Problem logging in programatically to a website using WebBrowser Control

查看:105
本文介绍了使用WebBrowser控件以编程方式登录到网站时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试图以编程方式登录 到" https://www. salesgenie.com/Account/LogOn 使用WebBrwoser控件.

问题是当我单击登录"时,浏览器无法导航到LogonCompleted事件中的下一页.

Hi,

I''m trying to login programatically to "https://www.salesgenie.com/Account/LogOn" using WebBrwoser control.

The problem is when I click on "Log On", the browser doesn''t navigate to the next page in the LogonCompleted event.

HtmlElement userName = wBrowser.Document.GetElementById("username");
userName.SetAttribute("value", SomeUserName);

HtmlElement password = wBrowser.Document.GetElementById("password");
password.SetAttribute("value", SomePassword);

wBrowser.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(LogonPageLoaded);
wBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(LogonCompleted);

HtmlElement logonForm = wBrowser.Document.GetElementById("logon-submit");
logonForm.InvokeMember("click");



我认为这是因为元素"logon-submit"调用了一个JavaScript函数左右.

请提供任何帮助.



I think this is because the element "logon-submit" calls a JavaScript function or so.

Please, any help would be appreciated.

推荐答案

使用Fiddler [ ^ ]来确定该站点在做什么.这就是我在这种情况下要做的.
Use Fiddler [^] to figure out what the site is doing. That''s what I do in a case like this.


这篇关于使用WebBrowser控件以编程方式登录到网站时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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