code to detect time of webpage finish loading in firefox?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
bars143
Posts: 87
Joined: 01 Sep 2013 20:47

code to detect time of webpage finish loading in firefox?

#1 Post by bars143 » 16 Jan 2014 03:00

hi to all expert,

is there any batch code to detect a time when one tab finish it load in firefox browser?

i had a batch code to run (50 tabs) with (15 seconds interval of sleep/wait) (per tab)
and i observed that not all 50 tabs are within 10-15 seconds to finish load of webpage. (actually my network-speed to complete load is averaging 15 seconds ) .

some other tabs can finish load from 5-8 seconds and
i need batch code to run next tab than waiting for timeout to finish 15-seconds before next run.


at this time when running code below -- i just manually press enter to bypass timeout if some tab finish it load earlier than 15-seconds wait-interval.


here is my code:

Code: Select all

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

:: after grabbing all links from one webpage (it is easy to grabbed all link and sort in batch file than manually remove blankline, unwanted link.etc)
:: then copy and paste its links to input.txt
:: i had already find code to match link i needed,

echo removing unneeded links,
echo deleting first batch of unmatched lines....
echo.

cmd /c FindRepl.bat "http://(\w+).(\w+).(\w+)(/\w+)(/\w+).\w+\?\w=\d&\w+=\d+&p=\w+#\w+" "" < input.txt > first_batch.txt

ping -n 5 localhost >nul
echo deleting last batch of unmatched lines .....
echo.

cmd /c FindRepl.bat "http://(\w+).(\w+).(\w+)(/\w+)(/\w+).\w+\?\w=\d&\w+=\d+&\w+=\w+" "" < first_batch.txt > last_batch.txt

ping -n 5 localhost >nul
echo start extracting matched line....
echo.

:: start extracting matched line only

cmd /c  FindRepl "http://(\w+).(\w+).(\w+)(/\w+)(/\w+).\w+\?\w=\d&\w=\d+\b" /$:0 /Q: < last_batch.txt >selected.txt

ping -n 5 localhost >nul

echo running all links listed in selected.txt:
echo.

set "count=0"

for /f %%a in (selected.txt) do (
set "m=%%a"

start "" firefox.exe -new-tab "!m!"

set /a "count+=1"
echo [!count!] = !m!
timeout 15
)
echo multi-tabs processing completed
echo manually start saving now by using UnMHT addons.
timeout 10
exit



hoping some answer my problem, so that i cant wait every tab load to manually press.
i really need automatic batch-script to load next run rather than waiting for timeout to expired.

but using a 5 seconds interval will result to 3-5 tabs still running at the same time and interfere each other connection which result of some are completed and other are failed (it required manual re-connection to finished load).
while 15-seconds interval had no conflicting connection because its one tab running and completed before 15-seconds expired.


any helps greatly appreciated.

bars

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: code to detect time of webpage finish loading in firefox

#2 Post by Ed Dyreen » 16 Jan 2014 14:42

not in batch, autoIT can do it

Code: Select all

#include <IE.au3> 
_IENavigate(ByRef $o_object, $s_url [, $f_wait = 1])

[optional] specifies whether to wait for page to load before returning
0 = Return immediately, not waiting for page to load
1 = (Default) Wait for page load to complete before returning
but autoIT only supports IExplorer natively, for firefox you need to download FF.au3 but I don't know whether FF.au3 supports this.
I google a bit for 'how to acces the DOM in firefox' but no satisfactory results yet

Post Reply