0

hi i'm trying to build an app that allow to login to instagram using c# when i run my application and logged in , i need to be redirected to fixed page without any reaction from me here's my code :

private void button1_Click(object sender, EventArgs e)
{
HtmlDocument doc = web.Document;
HtmlElement username = doc.GetElementById("id_username");
HtmlElement password = doc.GetElementById("id_password");
username.SetAttribute("value", "****");
password.SetAttribute("value", "****");
StringBuilder sb = new StringBuilder();
foreach (HtmlElement elm in web.Document.All)
if (elm.GetAttribute("value") == "Log in")
{
sb.Append(elm.InnerHtml);
Thread.Sleep(3000);
elm.InvokeMember("click");
// web.Navigate(@"https://instagram.com/accounts/password/change/"); // it navigate me but required to login again
}
}
private void web_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (web.ReadyState != WebBrowserReadyState.Complete)
{
MessageBox.Show("not logged in");
}
}
2
Contributors
1
Reply
6
Views
1 Year
Discussion Span
Last Post by DaveAmour
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.