How to get image tag and anchor tags attributes from iframe tags using C#.Net with add in express tool

Add-in Express™ Support Service
That's what is more important than anything else

How to get image tag and anchor tags attributes from iframe tags using C#.Net with add in express tool
 
vasanthilakshmanan lakshmanan




Posts: 5
Joined: 2010-09-13
Hi,

I have used following reguest to get image tags and attributes of image.

mshtml.HTMLImgClass imga in HTMLDocument.getElementsByTagName("img")

But this code could not read image tags and attributes of anchor tags under iframe tags.

So Kindly suggest about this issues.

Thanks in advance.
Posted 13 Sep, 2010 08:09:35 Top
Digvijay Chauhan




Posts: 8
Joined: 2010-08-09
Hi,

You must try to see which frame you should call the getElementsByTagName method.

Say doc is your HtmlDocument object then you can do something like

doc.Window.Frames[index].Document.GetElementsByTagName("img")

here you need to figure out the index or the name of the iframe.

Hope that helps!

/Digvijay
Posted 13 Sep, 2010 08:20:29 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hi vasanthilakshmanan,

Please follow the suggestion kindly provided by Digvijay (Thank you, Digvijay!).

Also check if IE fires several DocumentComplete/DownloadComplete events in your case. Probably, you will find the images in another document (frame).


Andrei Smolin
Add-in Express Team Leader
Posted 13 Sep, 2010 08:31:07 Top
vasanthilakshmanan lakshmanan




Posts: 5
Joined: 2010-09-13
Hello Digvijay ,

Thank you for your response. i have tried your code like

HtmlDocument.Window.Frames[index].Document.GetElementsByTagName("img"). But its not working fine.Does not show the window property in HtmlDocument. So kindly suggest me.
Posted 14 Sep, 2010 00:27:53 Top
Aswathi aswathi




Posts: 9
Joined: 2010-09-06
Hello,

I tried this same code in c#.net,
HtmlDocument.Window.Frames[index].Document.GetElementsByTagName("img"). And also received the same issue as above.

HtmlDocument Object does not show the window property. Can you provide any sample code as you worked or any other examples.
Posted 14 Sep, 2010 01:17:04 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hi Aswathi,

private void IEModule_DocumentComplete(object pDisp, string url)
{
    mshtml.IHTMLDocument2 doc = (pDisp as IE.IWebBrowser).Document as mshtml.IHTMLDocument2;
    System.Diagnostics.Debug.WriteLine("!!! " + doc.frames.length.ToString() + " " + doc.url);
}



Andrei Smolin
Add-in Express Team Leader
Posted 16 Sep, 2010 04:40:38 Top