Page 1 of 1

WebViewGadget() read value of a TAG

Posted: Mon Aug 05, 2024 7:07 pm
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