0

Is it possible to wait for a slow ajax element? In 95% the following code works fine, but in 5 % the Element needs more time to load and the Code will stop by showing a Error-Message.

driver.Wait 2000
driver.FindElementsByXPath("//button").Last.Click
Chris
  • 75
  • 1
  • 9
  • 1
    Possible duplicate of [Selenium Webdriver (VBA): Explicit Wait](https://stackoverflow.com/questions/37956889/selenium-webdriver-vba-explicit-wait) – JeffC Jul 30 '19 at 20:30

1 Answers1

0

You can use a variation in the old wait system used with Internet Explorer.

Do While SeDriver.FindElementsByXPath("//button").Last.IsDisplayed = False
    DoEvents
Loop

As needed, you can switch "IsDisplayed" with "IsPresent".