Using VBA to interact with a collapsible widget in IE

Status
Not open for further replies.

LCarney

New Member
Joined
Feb 10, 2020
Messages
24
Office Version
  1. 365
Platform
  1. Windows
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;
1592235998702.png

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";
1592236046607.png

Here's the HTML snippet;
1592236132835.png

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
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Duplicate Clicking on a link in a website using VBA

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top