This is part 2 from my original post here. So now once logged in, I have to make two clicks to display the information I'm ultimately trying to scrape. I cannot seem to figure out the proper way to drill down to get to the clicks to work. It is all buried within a form. The 1st image shows the form structure. The 2nd image shows all of the code where I'm trying to get to the Current Situation link below the Supervisor span. I had to use the following (as you see from my previous post) to get IE to stay connected so not sure if that has any impact:
Dim objIE As Object
Set objIE = GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}")
In an attempt to automate the Current Situation tab click, I've tried the following with no luck (with and without the 0)
objIE.document.getElementById("1617")(0).Click
I'm more interested in getting educated in addition to getting an answer. Is there a method to drilling down into information within a form? I was under the impression that ALL the elements of a webpage were pulled in during loading. So is this not truly an element in my minimal understanding with webpage automation?
As a note, I do have to click Supervisor to get the tree below it to display. Thanks in advance for your help!
UPDATE: Ok a major oversight here I think. Based on my previous post, the login functions perfectly. But once logged in, a new window gets created. So I believe that is the challenge, right? It can't find any of these IDs or Elements because it's looking at the original IE object, not the new window. So how do I get it to activate/access the new window? Sorry I missed that earlier!
Method
getElementById
returns a single element, not a collection, unlike for examplegetElementsByClassName
(look at "Element" vs "Elements" in method name). Therefore(0)
or any other index of collection should not be used.Correct syntax is:
objIE.document.getElementById("1617").Click
For pop-up windows try this:
For accessing an element within iFrame: