ant mar
Posts: 1
Joined: 2010-09-10
|
We need to read the page content like images tags and href tags etc.
We can get this by tool bar button click event by following code:
Code we used in button click event:
private void GetImageUrls1()
{
if (IEApp.Document != null)
{
//foreach (mshtml.HTMLAnchorElementClass anchor in
HTMLDocument.getElementsByTagName("a")) // find anchor tag
//{
// MessageBox.Show(anchor.href.ToString());
// MessageBox.Show(anchor.className.ToString());
// MessageBox.Show(anchor.IHTMLElement_innerText.ToString());
//}
//foreach (mshtml.HTMLImgClass imga in HTMLDocument.getElementsByTagName("img")) // find
img tag
//{
// MessageBox.Show(imga.href.ToString());
// MessageBox.Show(imga.width.ToString());
// MessageBox.Show(imga.height.ToString());
//}
int i = 0;
foreach (mshtml.HTMLImgClass imga in HTMLDocument.getElementsByTagName("img")) // find
img tag including anchor tag
{
if (imga.parentNode.nodeName.ToString() == "A")
{
MessageBox.Show(imga.parentElement.getAttribute("href", i).ToString());
}
if (imga.parentNode.nodeName.ToString() == "a")
{
MessageBox.Show(imga.parentElement.getAttribute("href", i).ToString());
}
MessageBox.Show(imga.href.ToString());
}
i++;
}
}
We need the same option in page load it means when after page content load it should read this content.
Can you please provide the sample code for this or can you guide us for complete this option. |
|
Andrei Smolin
Add-in Express team
Posts: 18848
Joined: 2006-05-11
|
Hi Ant,
When a web page is loaded, IE raises the DownloadComplete and DocumentComplete events.
You can add these events via the Events tab of the IE module designer (see the Properties window in Visual Studio).
Andrei Smolin
Add-in Express Team Leader |
|