trying to manipulate website thru vba

JimCarney6

New Member
Joined
Dec 5, 2018
Messages
1
I'm having an issue attempting to manipulate a website with vba. It is a secure website so I cant post it. I need suggestions i can test or if someone can explain what i'm missing.

so far i can open the website & login, no issue & i can click the button to navigate to the search screen, here i hit the wall. all i need to do is fill in a text box (then hit search). when i inspect the element on the text box I get:

however, it seems it's really a control group. this code:
Set HTMLInputs = HTMLDoc.getElementsByClassName
For Each HTMLInput In HTMLInputs
Debug.Print "ClassName:" & HTMLInput.className, "TagName:" & HTMLInput.tagName, "ID:" & HTMLInput.Id, "InnerText:" & LTrim(HTMLInput.innerText)
If InStr(HTMLInput.innerText, "Policy") > 0 Then
HTMLInput.value = "9509966270"
Exit For
End If
Next HTMLInput

looped successfully & found the field (i thought) but i cannot input into the text box. is it possible to tell what the item is that i'm looping thru in the elements collection? maybe i'm hitting a label not a text box. is it possible that its connected to the text box i want (it is the right text, just above it on the web page. i also saw something on using setattribute on an aria. any advice appreciated! thank you!
-Jim
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Your getElementsByClassName is wrong because it requires the class name as its string argument.

is it possible to tell what the item is that i'm looping thru in the elements collection? maybe i'm hitting a label not a text box.
Output HTMLInput.outerHTML to see the full HTML of the element. A text input element has type="text", so look for HTMLInput.type = "text".
 
Upvote 0

Forum statistics

Threads
1,223,631
Messages
6,173,465
Members
452,516
Latest member
archcalx

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