0
Set chkdata = New Selenium.ChromeDriver
chkdata.Get "http://example.com"
chkdata.Window.Maximize
chkdata.FindElementByName("ctl00$PublicMasterPage").WaitDisplayed.Click

Hi all, I have the above code which was working nice before but not now. Go to example.com, wait couple of seconds, maximize the window of Chrome and click a particular button. However, the server responding very slow recently causing VBA selenium message timeout and halt the program.

My questions:

  1. How long did the function (.Get) to determine the timeout situation and trigger to halt the program in VBA selenium?
  2. How can I set a timer for step 2? (Reload the webpage if it waits X sec)

Selenium Webdriver (VBA): Explicit Wait Selenium Webdriver (VBA): Explicit Wait

I find a solution above called explicit wait. But if the webpage got fully loaded in 6 sec say for an example, will it still wait till the time limit (let's say time limit is 1 min) before the program goes to stpe 3?

I expect setting a wait timer like 30 sec, if the page got loaded before 30s, the program is able to move immediately but not wait for 30s. Thank you.

exe127
  • 1
  • the .get() call will wait for the page to load. The timeout period there is, by default, pretty long but varies by browser. (I think it used to be like 5 minutes for Firefox) If it's getting stuck there, the only thing you can do is call .get() again after the timeout period. (you can try/catch it) You can set the page load timeout period for the get() call: https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/WebDriver.Timeouts.html#pageLoadTimeout(java.time.Duration) It's an option of the webdriver. – pcalkins Aug 07 '23 at 18:58

0 Answers0