I'm attempting to use VBA to navigate through a website. One of the many places I keep getting stuck is trying to open a collapsible widget to get to a link I need.
This is how far my code gets;
I need it to click on the "Contracts" widget so it opens up and looks like this so I can actually "Start a New Quote";
Here's the HTML snippet;
Here's the code I'm using so far. The code does seem to try to interact with it. It will make black vertical line show up to the left of the "Vehicle Protection Center" area, but obviously won't open the widget. I'm very new to VBA and newer to HTML, and am trying to learn for work. I appreciate and advise. TIA.
Sub AUTOFILL()
Dim IE As Object
Dim doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "Ally Auto Dealer Services | Financing, Training, Rewards & More | Ally Auto"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set doc = IE.document
IE.document.getElementById("user").Value = "CarnLucy"
IE.document.getElementById("password").Value = "Ally12345"
IE.document.getElementById("processLogin").Click
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.document.getElementsByTagName ("a")
IE.document.querySelector("[data-track-name='Vehicle Protection Center']").Click
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.document.getElementbyClassName("collapsible-widget closed").Click
End Sub
This is how far my code gets;
I need it to click on the "Contracts" widget so it opens up and looks like this so I can actually "Start a New Quote";
Here's the HTML snippet;
Here's the code I'm using so far. The code does seem to try to interact with it. It will make black vertical line show up to the left of the "Vehicle Protection Center" area, but obviously won't open the widget. I'm very new to VBA and newer to HTML, and am trying to learn for work. I appreciate and advise. TIA.
Sub AUTOFILL()
Dim IE As Object
Dim doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "Ally Auto Dealer Services | Financing, Training, Rewards & More | Ally Auto"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set doc = IE.document
IE.document.getElementById("user").Value = "CarnLucy"
IE.document.getElementById("password").Value = "Ally12345"
IE.document.getElementById("processLogin").Click
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.document.getElementsByTagName ("a")
IE.document.querySelector("[data-track-name='Vehicle Protection Center']").Click
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.document.getElementbyClassName("collapsible-widget closed").Click
End Sub