I am trying to navigate through a website using a VBA macro. I have been successful so far adapting my code off of this answer, but have come upon a situation where I need to click on a "logout" link that does not have an ID or Name when I inspect it (for reference, see below:)
Through some searching, it seems that the preferred method to find and direct VBA to click on this link is using querySelector. I've found various similar questions (see here, here, here, and here) which direct how to use it.
As a test, I simply tried the below to see if it would work:
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
'log in, click on various elements here
Set logoutButton = ie.document.queryselector("*")
MsgBox logoutButton
Unfortunately, VBA throws Run Time Error 438 on the querySelector line, and I'm unable to understand what it is that I'm doing incorrectly.
I have added the following references to VBA:
Could someone let me know what it is I'm missing that's causing this error? Additionally, is this the method that I should be using to click the link? Thanks!
EDIT: @QHarr has been helpful with finding out why I'm getting this issue: it's a problem with the emulation settings on Internet Explorer. querySelector will only work with document mode 9 and beyond, but my IE is defaulting to 8.
Even when I change the mode to 9 (and enable the Persist Emulation setting), it appears that my IE still opens with 8 and only changes to 9 when I check on the document mode. This causes me to still get the same error, unless I manually pause my code, check the document mode, then rerun the code.

