vba IE web scraperbutton click event works for some users but not others??

codeliftsleep

Board Regular
Joined
Apr 14, 2017
Messages
103
I am having an issue which has been driving me crazy trying to figure out. We have a site at work that we have to pull large amounts of data from every day. I created a web scraper which works perfectly fine for me, but for some reason others have issues using the same site. I have ruled out it being a computer issue, because I have gone on their computer, logged in under my name on the site and it works perfectly fine.
The problem is, the "Next Page" click event doesn't work with some users. It finds the button, fires the click event and nothing happens. When I log in, it fires the event with no issue. I have tried everything to get it to work. I tried to use:

<code>inputElement.FireEvent("on-click") (with a "-" included because it turns them into ****** otherwise???)
inputElement.click

</code>I am unsure how a click event can work or not work via code based on who the user is. Physically clicking on the button still works, just not firing the on-click event via code for some users(it works for me, most importantly).
Here are the relevant parts:

<code>Dim inputElement As HTMLInputElement
For Each inputElement In Document.getElementsByTagName("button")
If inputElement.Value = "Next Page" Then
Set inputElement = inputElement 'we set the next page button
Exit For
End If
Next inputElement
inputElement.Click

</code>I have checked and the button is always the right button, no matter the user, so that isn't an issue. I have to loop through the buttons to find the right one because it has no id, name or class.
Any ideas? This one is really baffling to me.
 
Last edited:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

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