I use the SHDocVw.InternetExplorer API in the VB.Net WinForms application to retrieve items from Internet Explorer. I can easily access the elements inside the parent document and the frame elements, but I can not access the elements inside the paste container. Here is an example code:
Dim ie As SHDocVw.InternetExplorer ie.Navigate("Some URL") ie.Visible = True Dim ieDoc As mshtml.IHTMLDocument2 = ie.Document 'All Elements Dim allElements = ieDoc.all 'Frames Dim allFrames = ieDoc.frames 'Fetch each frame and use its document to get all elements Dim allEmbed = ieDoc.embeds 'How to fetch document inside embed to access its elements?
And here is the html sample:
Sample.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Sample</title> </head> <body> <embed src="test.html" name="test1"/> </body> </html>
test.html
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Sample</title> </head> <body bgcolor="#FFFFFF"> <button>Button1</button> <label>Test 1</label> </body> </html>
How can I access the button and label inside Test.html loaded in Sample.html using the 'embed' tag?
Change 1 :
According to my research, I can access the document inside the "object" container using the .contentDocument property of the "object" element, but the same does not work for the "embed" container.
I can get some comObject using the getSVGDocument () property in the "embed" container, but cannot pass it to mshtml.IHTMLDocument2
source share