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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,213,491
Messages
6,113,963
Members
448,536
Latest member
CantExcel123

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