Reputation: 4539
First time trying this.
I have the following HTML
in a web page and I am using Excel
and VBA
to scrape data.
<div class="program-filters">
<span>Search for </span>
<a>
any gender <img src="/site/images/svg/DownArrow.svg" alt="Down Arrow" class="down-arrow-icon">
</a>
<span class="xs-hide">,</span>
<br class="sm-hide md-hide lg-hide">
<a>
all ages <img src="/site/image/svg/DownArrow.svg" alt="Down Arrow" class="down-arrow-icon">
</a>
to
<a>
play <img src="/site/images/svg/DownArrow.svg" alt="Down Arrow" class="down-arrow-icon">
</a>
<br class="sm-hide md-hide lg-hide"> near
<div style="display: inline-block;">
<input role="combobox" aria-autocomplete="list" autocomplete="off" value="SEARCH VALUE HERE">
</div>
<a class="in-map-btn btn btn-primary btn-go btn-mobile-fixed">GO</a>
</div>
How do I target the input role="combobox"
as it has no id or class. With jQuery
I would find this input inside div class="program-filters"
.
Thank you
Upvotes: 0
Views: 98
Reputation: 2412
Assuming that you already have a HTML Document to work on, you can do it like this:
myHTMLDoc.GetElementsbyTagName("INPUT")(0).value = myValue
It would work if this is always the first input box on this page. Clicking on a button to submit input boxes filled this way sometimes requires to change class of the input box, to emulate change which happens when this field is filled manually, else JS verification will consider the field empty.
Upvotes: 1