Page 1 of 1

[Solved] WebGadget: How to get PageTitle with #PB_Web_Edge flag?

Posted: Sat Apr 27, 2024 9:23 am
by Techmas
Hi, I encountered the following issue concerning WebGadget:

It seems that the PageTitle can only be fetched, if the #PB_Web_Edge flag is not set. How can i get it to work with #PB_Web_Edge?
I am grateful for suggestions!

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 GetGadgetItemText(0, #PB_Web_PageTitle)

	Repeat 
	Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf

WebGadget: How to get PageTitle with #PB_Web_Edge flag?

Posted: Mon Nov 18, 2024 9:10 pm
by Techmas
Thanks to mve001 the problem could be solved by adding a loop to wait until the website's title has changed instead of #PB_Web_Busy returns 0. It seems that #PB_Web_Busy may return 0 before the page is fully loaded.

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 Len(GetGadgetItemText(0, #PB_Web_PageTitle)) = 0
	    WindowEvent()
	Wend

	Debug GetGadgetItemText(0, #PB_Web_PageTitle)

	Repeat 
	Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf
Bug report