Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
5
Reply
An object reference is required for the non-static field
Karthi Keyan
May 13 2017 8:04 AM
243
Reply
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.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
Web Automation Process.
How to create custom login without ASP Login Control