I have been playing a bit with v2 and found myself hitting Error Error 0x80020101 when accessing the DOM while using an InternetExplorer.application object for testing.
This code here is the v1 code I was testing:
Code: Select all
IAutomation := ComObjCreate("InternetExplorer.Application")
IAutomation.Visible := true
IAutomation.Navigate("https://www.autohotkey.com")
document := IAutomation.document
while (IAutomation.busy || IAutomation.readyState != 4)
sleep 50
while (!document.querySelectorAll("div.mbr-article a"))
sleep 50
if (document.querySelectorAll("div.mbr-article a"))
{
document.querySelectorAll("div.mbr-article a")[1].scrollIntoView(true)
document.querySelectorAll("div.mbr-article a")[1].click()
}
Code: Select all
IAutomation := ComObject("InternetExplorer.Application")
IAutomation.Visible := true
IAutomation.Navigate("https://www.autohotkey.com")
document := IAutomation.document
while (IAutomation.busy || IAutomation.readyState != 4)
sleep 50
while (!document.querySelectorAll("div.mbr-article a"))
sleep 50
if (document.querySelectorAll("div.mbr-article a"))
{
document.querySelectorAll("div.mbr-article a")[1].scrollIntoView(true)
document.querySelectorAll("div.mbr-article a")[1].click()
}
While testing I noticed that this is the offending part: document.querySelectorAll("div.mbr-article a")[1], and I assume it has to do with the new difference in accesting items and properties in v2... It starts working perfectly fine as soon as I change the code to:
Code: Select all
if (document.querySelectorAll("div.mbr-article a"))
{
document.querySelectorAll("div.mbr-article a").1.scrollIntoView(true)
document.querySelectorAll("div.mbr-article a").1.click()
}
Is this behavior correct? I would assume it is not, since that syntax implies that .1 is a property and not an array item as it actually is.
Is there any workaround to not use that syntax atm?
Thanks for the help!