WebViewGadget() read value of a TAG

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5500
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

WebViewGadget() read value of a TAG

Post by Kwai chang caine »

Hello at all

With WebViewGadget() i can modify easily a value of a tag in a variable "MyValue" and show it the alert box 8)
But is it possible to get this same value of "MyValue" directly in IDE debugger ?

Code: Select all

 OpenWindow(0, 100, 100, 1000, 800, "Salut", #PB_Window_SystemMenu)
  WebViewGadget(0, 0, 0, 1000, 800)
  SetGadgetItemText(0, #PB_WebView_HtmlCode, Html$)
  SetGadgetText(0, "https://purebasic.fr")
  
  For i = 1 To 200
   WindowEvent()
   Delay(10)
  Next
   
  WebViewExecuteScript(0, ~"document.getElementsByClassName(\"title\")[0].textContent = \"KCC\";")
  
  For i = 1 To 200
   WindowEvent()
   Delay(10)
  Next
  
  Debug WebViewExecuteScript(0, ~"var MyValue = document.getElementsByClassName(\"title\")[0].textContent;alert(MyValue)")
  
  Repeat 
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
Have a good day
ImageThe happiness is a road...
Not a destination