0

Trying to click button using IE. Button

Due to the firm policy Selenium Basic, is banned. So using that route is not possible.

getting error Object variable not set (Error 91)

code till now.

Global driver As Object
Dim html As HTMLDocument

Set driver = CreateObject("InternetExplorer.Application")
with driver
    Const Url$ = "My URL"
         .Visible = True
         .Navigate Url
Set hmtl = .Document
    Do
      DoEvents
    Loop Until .ReadyState = 4
    html.queryselector("input#btnFilter").Click
end with

while using Selenium I was able to click it without problems, also tried it like this

driver.Document.getElementsByClassname("objectButton")(1).Click

which does not yield error, but looks like it freezes the page, if I do it manually, it works fine.

1 Answer 1

0

There is no click event in the button html. Probably there is a click event on the class or the section or the document. I don't know if this click event is triggered when you click on the button by vba code. Try to find the click event and trigger it directly. For the button you can also use GetelementbyId("btnFilter"). But probably it will no trigger the click function.

1
  • It has Event: click, so that means it should trigger right? It is handled by Jquery.
    – jan benes
    Commented Apr 4, 2023 at 11:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.