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");
}
}