Saving OuterHTML using Await Implementation with TWebView

Re: Saving OuterHTML using Await Implementation with TWebView

Postby Otto » Fri Aug 18, 2023 8:38 pm

Hello Charles,

In the past, I had some problems with SysWait().

I think you should use a timer.

viewtopic.php?f=3&t=36667&p=218689&hilit=syswait&sid=baaa9792d603f7acacf7427eeacfd234#p218689

I tested your suggestion with syswait in a loop, and it's consuming 25% of the CPU.

I can't recall precisely, but I believe it blocks the program.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6005
Joined: Fri Oct 07, 2005 7:07 pm


Re: Saving OuterHTML using Await Implementation with TWebView

Postby CharlesKwon » Mon Aug 21, 2023 6:04 am

Hello Otto.

SysWait() is not a timer. Could you please provide a detailed explanation of what it is used for? Alternatively, if you'd like, you can share your email, and I'll provide you with my WhatsApp contact.

Regards,
Charles KWON

Otto wrote:Hello Charles,

In the past, I had some problems with SysWait().

I think you should use a timer.

viewtopic.php?f=3&t=36667&p=218689&hilit=syswait&sid=baaa9792d603f7acacf7427eeacfd234#p218689

I tested your suggestion with syswait in a loop, and it's consuming 25% of the CPU.

I can't recall precisely, but I believe it blocks the program.

Best regards,
Otto
User avatar
CharlesKwon
 
Posts: 28
Joined: Sun Nov 02, 2014 7:03 am

Re: Saving OuterHTML using Await Implementation with TWebView

Postby leandro » Tue Aug 22, 2023 2:29 pm

Listo ya logre integrar la clase a la aplicación, parece que el problema eran los puntos suspensivos que tiene código, según lo visto no son compatibles con xharbour.
Code: Select all  Expand view

    ::bOldBind := ::oWeb:bOnBind
    ::oWeb:bOnBind := { | cJson, cCalls, ... | ::GetBind( cJson, cCalls, ... ) } //<-ESTOS SON LOS QUE GENERABAN EL ERROR

    cEval := STRTRAN( cEval, "$QUERY$", cQuery )
   
    ::cReturn := ""
 


Por otro lado, Antonio, esta clase tambien va a ser incluida en el nuevo Build de FW?
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Saving OuterHTML using Await Implementation with TWebView

Postby CharlesKwon » Wed Aug 23, 2023 1:24 am

leandro,

If the ellipsis (...) doesn't work in xharbour, feel free to remove it. If the program I provided codes as desired, I would appreciate it if you could capture a screenshot and let me know.

Regards,
Charles KWON


leandro wrote:Listo ya logre integrar la clase a la aplicación, parece que el problema eran los puntos suspensivos que tiene código, según lo visto no son compatibles con xharbour.
Code: Select all  Expand view

    ::bOldBind := ::oWeb:bOnBind
    ::oWeb:bOnBind := { | cJson, cCalls, ... | ::GetBind( cJson, cCalls, ... ) } //<-ESTOS SON LOS QUE GENERABAN EL ERROR

    cEval := STRTRAN( cEval, "$QUERY$", cQuery )
   
    ::cReturn := ""
 


Por otro lado, Antonio, esta clase tambien va a ser incluida en el nuevo Build de FW?
User avatar
CharlesKwon
 
Posts: 28
Joined: Sun Nov 02, 2014 7:03 am

Re: Saving OuterHTML using Await Implementation with TWebView

Postby Antonio Linares » Wed Aug 23, 2023 2:31 pm

leandro wrote:Listo ya logre integrar la clase a la aplicación, parece que el problema eran los puntos suspensivos que tiene código, según lo visto no son compatibles con xharbour.
Code: Select all  Expand view

    ::bOldBind := ::oWeb:bOnBind
    ::oWeb:bOnBind := { | cJson, cCalls, ... | ::GetBind( cJson, cCalls, ... ) } //<-ESTOS SON LOS QUE GENERABAN EL ERROR

    cEval := STRTRAN( cEval, "$QUERY$", cQuery )
   
    ::cReturn := ""
 


Por otro lado, Antonio, esta clase tambien va a ser incluida en el nuevo Build de FW?


Una vez os funcione bien, podemos incluirla en FWH
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Saving OuterHTML using Await Implementation with TWebView

Postby leandro » Wed Aug 23, 2023 3:16 pm

Charles de momento hicimos funcionar tu ejemplo...

En el transcurso de la semana voy a empezar a usar la clase mas a fondo. Apenas tenga otra imagen con lo que hicimos tambien te la hare llegar.

Muchas gracias por el aporte

Image

Code: Select all  Expand view

FUNCTION GetOuterHtml( oDlg  )
   LOCAL cStr
   LOCAL nCounter := 0
   LOCAL lOk  := .f.

   oWebVw2 := TWebView():New( , oDlg:hWnd )
   oWebVw2:Navigate( "https://login.yahoo.com/" )

   SysWait()
   Sleep(3000)
   SysWait()
   
   WHILE .T.
     
      ++nCounter
      cStr := AWait_QuerySelector( oWebVw2, "document.readyState", 3000 )  

      IF cStr == "complete"
         lOk := .t.
         EXIT
      ENDIF      

      SysWait()

      IF nCounter == 10
         EXIT
      ENDIF  

   ENDDO

   IF !lOk
      MsgStop("Timeout! Try again")
      RETURN NIL
   ENDIF

   AWait_SetValue( oWebVw2, "#login-username", "leandro arevalo")
   AWait_Click( oWebVw2, "#login-signin" )

RETURN NIL
 
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Saving OuterHTML using Await Implementation with TWebView

Postby CharlesKwon » Thu Aug 24, 2023 5:14 am

leandro,
Gracias por compartir los resultados. Si surge algún problema durante el proceso, no dudes en informarme en cualquier momento, y haré lo posible por brindarte ayuda.

Regards,
Charles KWON



leandro wrote:Charles de momento hicimos funcionar tu ejemplo...

En el transcurso de la semana voy a empezar a usar la clase mas a fondo. Apenas tenga otra imagen con lo que hicimos tambien te la hare llegar.

Muchas gracias por el aporte

Image

Code: Select all  Expand view

FUNCTION GetOuterHtml( oDlg  )
   LOCAL cStr
   LOCAL nCounter := 0
   LOCAL lOk  := .f.

   oWebVw2 := TWebView():New( , oDlg:hWnd )
   oWebVw2:Navigate( "https://login.yahoo.com/" )

   SysWait()
   Sleep(3000)
   SysWait()
   
   WHILE .T.
     
      ++nCounter
      cStr := AWait_QuerySelector( oWebVw2, "document.readyState", 3000 )  

      IF cStr == "complete"
         lOk := .t.
         EXIT
      ENDIF      

      SysWait()

      IF nCounter == 10
         EXIT
      ENDIF  

   ENDDO

   IF !lOk
      MsgStop("Timeout! Try again")
      RETURN NIL
   ENDIF

   AWait_SetValue( oWebVw2, "#login-username", "leandro arevalo")
   AWait_Click( oWebVw2, "#login-signin" )

RETURN NIL
 
User avatar
CharlesKwon
 
Posts: 28
Joined: Sun Nov 02, 2014 7:03 am

Re: Saving OuterHTML using Await Implementation with TWebView

Postby leandro » Fri Aug 25, 2023 12:56 am

Charles buenas noches como estas?

Que pena molestarte, pero nos surge la necesidad de eliminar algunos de los elementos DOM, no se si ya esta contemplado?

Al mismo tiempo tambien necesitamos recuperar algunos de los atributos de las etiquetas, no se si ya lo tengas implementado?, para el caso en cuestión, necesitamos recuperar y tambien actualizar el atributo data-dvr del input .

Code: Select all  Expand view

<input id='txt_cod' data-dvr='8'>777777</input>
 


De antemano gracias
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Saving OuterHTML using Await Implementation with TWebView

Postby CharlesKwon » Fri Aug 25, 2023 7:50 am

leandro

Buenas tardes.
¿Podría proporcionar una explicación detallada de exactamente qué funcionalidad debe ser implementada?


Regards,
Charles KWON


leandro wrote:Charles buenas noches como estas?

Que pena molestarte, pero nos surge la necesidad de eliminar algunos de los elementos DOM, no se si ya esta contemplado?

Al mismo tiempo tambien necesitamos recuperar algunos de los atributos de las etiquetas, no se si ya lo tengas implementado?, para el caso en cuestión, necesitamos recuperar y tambien actualizar el atributo data-dvr del input .

Code: Select all  Expand view

<input id='txt_cod' data-dvr='8'>777777</input>
 


De antemano gracias
User avatar
CharlesKwon
 
Posts: 28
Joined: Sun Nov 02, 2014 7:03 am

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 97 guests