I’m using SHDocVw.InternetExplorer APIs in my Vb.Net WinForms application to fetch elements from Internet Explorer. I can easily access the elements inside parent document and frame elements but I am not able to access the elements inside the 'embed' container. Here's the sample 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's a sample html:
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 the Test.html loaded in Sample.html using 'embed' tag?
Edit 1:
As per my research I can access the document inside the 'object' container using the .contentDocument property of 'object' element but the same is not working for 'embed' container.
I can get some comObject using getSVGDocument() property on 'embed' container but not able to cast it to mshtml.IHTMLDocument2