Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wait in Firefox and Chrome
#4
[quote="Gintaras"]Functions to wait while web browser is busy (loading page).

Hi Gintaras, good morning. I'm having problems with an update of Chrome and the routines ChromeWait that was working well. But now it return an error because it not recongnize the end to wait. Put ahead an adaptation of ChromeWait (just changes for spanish, no more that). I'll appreciate your help to determinate what happend. Thanks ins advance and forgive my English.

/
function [$url]

;This is a little adaptation to "ChromeWait" designed and programmed by Gintaras at QM Forum.
;Waits until Chrome is busy (loading page).
;Error if fails, eg if Chrome closed while waiting.

;url - web page address to open.
;;;If empty, just waits while Chrome is busy.
;;;Can include command line, eg "--disable-extensions ''url''".

;To get "busy" state, uses accessible object properties of main toolbar and its Reload button. Also uses window name.
;If your Chrome uses language other than English, the default values may not match.
;Then the function fails (error). Open this function and change the first 4 variables.
;You can discover the values using the 'Find Accessible Object' dialog.


;variables to change. Usually only the last two.
str windowName="Chrome" ;;can be partial
str toolbarName="Barra" ;;can be partial
str buttonName="Cargar " ;;can be partial / In Spanish is Ok In Spanish is Ok this translate. But it's not be comparing ok.
str buttonDescriptionBeginsWith="Cargar página " ;;begins with / In Spanish is Ok this translate.

;____________________________________________

This part is only to demostrate the values of Chrome Windows in differentes instances
State: Finished the download
int w=win("PLOG 23488 en SRSPLOG - Google Chrome" "Chrome_WidgetWin_1")
Acc a1.Find(w "PUSHBUTTON" "Cargar de nuevo" "class=Chrome_WidgetWin_1" 0x1005)

State: While is Downloading
I can't get it like before. But, the button say "Interrumpir la carga de esta página" while is loading
;____________________________________________

spe 100
;run chrome and get window handle
int w1
if(empty(url)) w1=win(windowName "Chrome_WidgetWin_0"); if(!w1) run "chrome" "" "" "" 0x200 3
else run "chrome" url "" "" 0x200 3
Espera hasta que esté visible WV
w1=wait(30 WV win(windowName "Chrome_WidgetWin_0"))

Espera hasta que se crea WC
w1=wait(30 WC win(windowName "Chrome_WidgetWin_0"))

;get toolbar acc
Acc a=acc(toolbarName "TOOLBAR" w1 "" "" 0x1000 0 0 "" 30)
;get Reload button acc
a=acc(buttonName "PUSHBUTTON" a "" "" 16) ;;a.Navigate("c3") would be unreliable
;wait until description changes from "Stop*" to "Reload*"
;In this case, description change from "Interrumpir*" to "Cargar*". Something in the kind of buttoms changed in Chrome.
int n
rep
0.1
_s=a.Description;; out _s
Here is, maybe, the problem..... The active buttom
if(_s.begi(buttonDescriptionBeginsWith)) n+1; if(n=10) break
else n=0

err+ end ES_FAILED


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)