Home:ALL Converter>Selecting HTML dropdown with ReactJS in VBA

Selecting HTML dropdown with ReactJS in VBA

Ask Time:2019-03-20T07:24:37         Author:Matt Sebastian

Json Formatter

I'm trying to use VBA to select a dropdown item from an HTML website that uses ReactJS. For this example, we can use the following website:

https://jedwatson.github.io/react-select/

<span class="Select-value-label" role="option" aria-selected="true" id="react-select-2--value-item">New South Wales</span>

If an HTML page lists all the select options on the dropdown, I can easily set the elementID to one of the dropdown values.

Set ie = CreateObject("InternetExplorer.Application") 
With ie
    .Visible = True
    .Navigate "about:blank"
    'with for page load
    ieWaitForURL

    .Navigate "https://jedwatson.github.io/react-select/"

    ie.Document.getelementbyid("react-select-2--value-item").Value = "Victoria"

But the HTML of the ReactJS website doesn't list all the options of the dropdown, and the value of the innertext changes as I make a different selection.

Is there a way to select from a ReactJS dropdown using VBA if all the options aren't listed in the HTML?

Author:Matt Sebastian,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/55251395/selecting-html-dropdown-with-reactjs-in-vba
yy