Dear Mr.Excel;
please help with resolving the 'JavaScript error: circular reference' error in the following macro (using Excel 2010, VBA 7.0):
where the F:\TEST.HTML file looks like this:
Thanks in advance,
S.Br.
please help with resolving the 'JavaScript error: circular reference' error in the following macro (using Excel 2010, VBA 7.0):
VBA Code:
Option Explicit 'VBA 7.0
Sub Macro1()
Dim ChrmDrv As ChromeDriver
Dim objBody As Object, objChildNodes As Object
Dim nKids As Integer
Set ChrmDrv = New ChromeDriver
If ChrmDrv Is Nothing Then Exit Sub
With ChrmDrv
.Start "CHROME"
.Get "file://F:\TEST.HTML"
End With
Set objBody = ChrmDrv.ExecuteScript("return document.getElementsByTagName('body')[0];")
If objBody Is Nothing Then Exit Sub
nKids = ChrmDrv.ExecuteScript("return arguments[0].childNodes.length;", objBody)
MsgBox nKids 'shows 3
Set objChildNodes = ChrmDrv.ExecuteScript("return arguments[0].childNodes;", objBody) 'JavaScript error: circular reference
Set objChildNodes = Nothing
Set objBody = Nothing
ChrmDrv.Quit
Set ChrmDrv = Nothing
End Sub
where the F:\TEST.HTML file looks like this:
HTML:
<!DOCTYPE html>
<html>
<head> </head>
<body>
<!-- Just an HTML comment... -->
</body>
</html>
Thanks in advance,
S.Br.