Both,
You may be interested in my code below. I'm still learning about Selenium Chrome/Edge automation and its differences to IE and the MS HTML library. Apart from the different classes and methods, etc. the biggest difference I've found is that Selenium works in the same way that a user would interact with a web page. For example, it has to click on a dropdown to display the options, allowing them to be selected; if an element isn't visible on the page, it has to scroll to make it visible. None of this is necessary with IE/MS HTML - if an element is present in HTML DOM, it can be automated directly.
VBA Code:
Option Explicit
Dim driver As Selenium.EdgeDriver
Public Sub Edge_Click_Dropdown_Options()
Dim URL As String
Dim span As WebElement
Dim button As WebElement
Dim selectOption As WebElement
Dim listboxDiv As WebElement
Dim form As WebElement
URL = "https://www.carousell.sg/search/smart%20watch?addRecent=true&canChangeKeyword=true&includeSuggestions=true&searchId=rojMFM&t-search_query_source=direct_search"
Set driver = New Selenium.EdgeDriver
With driver
.Start
.Get URL
End With
'Find 'More filters' and click its button
Set span = driver.FindElementByXPath("//span[text()='More filters']", timeout:=1000, Raise:=False)
Set button = span.FindElementByXPath("./../..")
button.Click
'Find Condition dropdown and click its button
Set listboxDiv = driver.FindElementById("FieldSetField-Container-field_layered_condition")
Set button = listboxDiv.FindElementByXPath(".//button")
driver.ExecuteScript "arguments[0].scrollIntoView(true);", button
button.Click
'Find and click the 'Like new' and 'Heavily used' options
Set selectOption = listboxDiv.FindElementByXPath(".//*[@data-testid='Like new']")
selectOption.Click
Set selectOption = listboxDiv.FindElementByXPath(".//*[@data-testid='Heavily used']")
selectOption.Click
'Find and click the Apply button. This button is a child of the form, which is the parent-parent of the Condition dropdown
Set form = listboxDiv.FindElementByXPath("./../..")
Set button = form.FindElementByXPath(".//button[@role='submitButton']")
button.Click
End Sub