0

I wonder why VBA cannot find element Id which is unique. This is very simple but I want to know the reason why.

In other website, I can do findelementbyid or css. enter image description here

I tried to find this element by using below code but it failed. Do you have any idea?

bot.FindElementById("a_74").SendKeys "ht"
JaSON
  • 4,843
  • 2
  • 8
  • 15
HTKIM
  • 25
  • 2
  • 8

1 Answers1

0

Are you sure it's the FindElementById that fails? (i don't code in VBA so i had to take an example). If so, since Explicit Wait are not available in VBA (i think) you could use a loop to retry the search certain times :

Dim t As Date, ele As Object
t = Timer
Do
    DoEvents
    On Error Resume Next
    Set ele = .FindElementById("a_74")
    On Error GoTo 0
If Timer - t = 10 Then Exit Do
Loop While ele Is Nothing

From : Selenium Webdriver (VBA): Explicit Wait

Handler
  • 194
  • 10
  • Thank you. I tried with this code as well. but there was error with '21': TimeoutError. The driver failed to open the listening port ..- – HTKIM Jul 24 '20 at 12:05