TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Karthi Keyan
1k
755
237.5k
An object reference is required for the non-static field
May 13 2017 8:04 AM
Hi,
public void load()
{
WebBrowser.Navigate("some site login Page");
_Processing = true;
var username = ConfigurationManager.AppSettings["username"];
var password = ConfigurationManager.AppSettings["password"];
while (_Processing)
{
Application.DoEvents();
if (
WebBrowser.ReadyState
== WebBrowserReadyState.Complete ||
WebBrowser.ReadyState
== WebBrowserReadyState.Interactive)
{
var htmlDocument = this.
WebBrowser
.Document;
if (htmlDocument != null)
{
foreach (HtmlElement tag in htmlDocument.GetElementsByTagName("input"))
{
switch (tag.Name)
{
case "username":
tag.InnerText = username;
break;
case "password":
tag.InnerText = password;
break;
case "cmdlogin":
tag.RaiseEvent("onclick");
tag.InvokeMember("Click");
break;
}
}
}
_Processing = false;
}
}
}
the Yellow Marked Line's show's the error.
An object reference is required for the non-static field, method, or property 'WebBrowser.Navigate(string)'
I can't understand what happend in the function. can any one help me to solve this issue.
Thanks In Advance.
Reply
Answers (
5
)
Web Automation Process.
How to create custom login without ASP Login Control