WebGadget: #PB_Web_Busy returns 0 before page is fully loaded
Posted: Sat Nov 23, 2024 5:56 pm
It seems that #PB_Web_Busy returns 0 before the page is fully loaded.
In the below example, #PB_Web_PageTitle returns nothing after #PB_Web_Busy returns 0. The PageTitle can only be fetched by adding another loop to wait until the website's title actually has changed.
In the below example, #PB_Web_PageTitle returns nothing after #PB_Web_Busy returns 0. The PageTitle can only be fetched by adding another loop to wait until the website's title actually has changed.
Code: Select all
If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebGadget(0, 0, 0, 600, 300, "https://duckduckgo.com/", #PB_Web_Edge)
While GetGadgetAttribute(0, #PB_Web_Busy) <> 0
WindowEvent()
Wend
Debug "Page Title=" + GetGadgetItemText(0, #PB_Web_PageTitle) ;=> returns nothing
While Len(GetGadgetItemText(0, #PB_Web_PageTitle)) = 0
WindowEvent()
Wend
Debug "Page Title=" + GetGadgetItemText(0, #PB_Web_PageTitle) ;=> returns page title
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf