-
Hi Selenium allows for a "page load strategy" options, set to "none / normal / eager", this defines the readystate to wait before continuing the code. Is there a way to set this with SeleniumVBA ? I would like to set the NavigateTo for several windows at onse and then wait for the pages to download instead of waiting for each page in sequence. Thanks for any help ! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @Pat075, Yes, SeleniumVBA let's you do just about anything when it comes to setting browser options/capabilities. We don't yet have a specific high-level command for setting that particular option, but if you can provide a complete use case, we will consider adding that command. In the meantime, here is how you would change the page load strategy from "normal" (default) to "eager" or "none" using the WebCapabilities object: Sub test_pageLoadStrategy()
Dim driver As WebDriver
Dim caps As WebCapabilities
Set driver = New WebDriver
driver.StartChrome
'note that WebCapabilities object should be created after starting the driver (StartEdge, StartChrome, of StartFirefox methods)
Set caps = driver.CreateCapabilities()
caps.SetCapability "pageLoadStrategy", "none" '"eager" "normal" - default is "normal"
driver.OpenBrowser caps 'here is where caps is passed to driver
driver.NavigateTo "https://www.wikipedia.org/"
'print the session info to see if pageLoadStrategy is set to desired value (Edge/Chrome only)
Debug.Print WebJsonConverter.ConvertToJson(driver.GetSessionsInfo, 4)
driver.Wait 1000
driver.CloseBrowser
driver.Shutdown
End Sub PS: There is also functionality to preload the pageLoadStrategy capability setting without having to mess around with the WebCapabilities object in the case where you want to change the default value from "normal" to one of the other values. To learn more, see these two topics in the Wiki: Working with Capabilities Let us know how it goes! |
Beta Was this translation helpful? Give feedback.
-
@Pat075 - SetPageLoadStrategy command added in version 5.0. |
Beta Was this translation helpful? Give feedback.
Hi @Pat075,
Yes, SeleniumVBA let's you do just about anything when it comes to setting browser options/capabilities. We don't yet have a specific high-level command for setting that particular option, but if you can provide a complete use case, we will consider adding that command. In the meantime, here is how you would change the page load strategy from "normal" (default) to "eager" or "none" using the WebCapabilities object: