using webBrowser component and parsing the html tags ??

thnk you timvw, Rizawan and Indian Ocean..

I have worked out with following code :

this will search user and paswd textbox and also call the Login.js

now I want to handle the links on the next page ie the page after login ..

I have used webbrowser control in my application.

private void Form1_Load(object sender, System.EventArgs e)

{

textBox_Url.Focus();

}

private void button_Click_Click(object sender, System.EventArgs e)

{

object empty = null;

this.MitWebBrowser1.Navigate(textBox_Url.Text,ref empty, ref empty, ref empty, ref empty);

}

private void MitWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)

{

HTMLDocument myDoc = new HTMLDocumentClass();

myDoc =(HTMLDocument)MitWebBrowser1.Document;

try

{

//----------https://www.bnyinvestorreporting.com/login.jsp---------//

mshtml.IHTMLElementCollection msHeader = myDoc.getElementsByTagName("a");

try

{

myDoc.getElementById("username").innerText = textBox_UserId.Text.ToString();

myDoc.getElementById("password").innerText = textBox_Pswd.Text.ToString();

foreach(mshtml.IHTMLElement Element in msHeader)

{

if(((mshtml.HTMLAnchorElementClass)(Element)).IHTMLElement_outerText == "Login")

{

object obj = Element;

Element.click();

}

}

}

catch(Exception ex)

{

MessageBox.Show(ex.Message);

}

}

catch(Exception ex)

{

MessageBox.Show(ex.Message);

}

Console.WriteLine("Hello");

}

private void pantop_Paint(object sender, System.Windows.Forms.PaintEventArgs e)

{

}

}

}




Answer this question

using webBrowser component and parsing the html tags ??

  • using webBrowser component and parsing the html tags ??