IF Page exceeds Timeout --> run URL GOTO= again [SOLVED]

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
cjseriy
Posts: 16
Joined: Wed Jul 04, 2018 12:53 pm

IF Page exceeds Timeout --> run URL GOTO= again [SOLVED]

Post by cjseriy » Sun Jul 08, 2018 4:23 pm

Hello,

I would appreciate your help with 2 questions: :roll:

1. How to run URL GOTO= again when there is an error "Page loading timeout" ?

2. Is there a way to extract and save in csv iMacros errors using SAVEAS command?

Code: Select all

Errors like: RuntimeError: frame 2 not found, line 53 (Error code: -922)

VERSION BUILD=11.5.498.2403
Windows 10
iMacros Browser + Firefox iMacros 8.9.7
Firefox 49.0.2
Last edited by cjseriy on Mon Jul 09, 2018 7:45 pm, edited 1 time in total.
chivracq
Posts: 8535
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: IF Page exceeds Timeout --> run URL GOTO= again

Post by chivracq » Sun Jul 08, 2018 11:03 pm

cjseriy wrote:Hello,

I would appreciate your help with 2 questions: :roll:

1. How to run URL GOTO= again when there is an error "Page loading timeout" ?

2. Is there a way to extract and save in csv iMacros errors using SAVEAS command?

Code: Select all

Errors like: RuntimeError: frame 2 not found, line 53 (Error code: -922)

Code: Select all

VERSION BUILD=11.5.498.2403 
Windows 10 
iMacros Browser + Firefox iMacros 8.9.7
Firefox 49.0.2
1- You can do a "Conditional Refresh"... (Well, is a "Conditional 'URL GOTO' actually, can't be applied to any iMacros Commands, like 'REFRESH'...)
And either you loop your Script, or you hard-code a few times how many times you want to "try" the Reload...

2- Nope, I don't think so, not from pure '.iim'. :oops:
Hum..., though I guess it gets saved in the Log File if you use the 'Profiler'...
But otherwise, yep, possible from a '.js' Script with 'iimGetErrorText()'... :)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
cjseriy
Posts: 16
Joined: Wed Jul 04, 2018 12:53 pm

Re: IF Page exceeds Timeout --> run URL GOTO= again

Post by cjseriy » Mon Jul 09, 2018 7:40 pm

Thank you very much for the direction towards Conditional Refresh. I was able to find your code from one of a threads.
I modified it a bit. Here it is:

Code: Select all

SET URL_Site1 http://www.site.com

URL GOTO={{URL_Site1}}
WAIT SECONDS=5
SET !TIMEOUT_STEP 0
TAG POS=1 TYPE=A ATTR=TXT:*Terms<SP>of<SP>Service* EXTRACT=TXT
'popup window will appear if page doesnt load and then it will be refreshed
SET !VAR1 EVAL("var text=\"{{!EXTRACT}}\"; if(text==\"#EANF#\") text = \"YES\";else text = \"NO\";text;")
SET !EXTRACT_TEST_POPUP {{!VAR1}}
TAG POS=1 TYPE=A ATTR=TXT:*Terms<SP>of<SP>Service* EXTRACT=TXT
SET URL_Refresh EVAL("var s='{{!EXTRACT}}'; var u='{{URL_Site1}}'; var x; if(s=='#EANF#'){x=u;} else {x='';}; x;")
SET EXTRACT NULL

WAIT SECONDS=2
URL GOTO={{URL_Refresh}}
chivracq
Posts: 8535
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: IF Page exceeds Timeout --> run URL GOTO= again

Post by chivracq » Mon Jul 09, 2018 7:53 pm

cjseriy wrote:Thank you very much for the direction towards Conditional Refresh. I was able to find your code from one of a threads.
I modified it a bit. Here it is:

Code: Select all

SET URL_Site1 http://www.site.com

URL GOTO={{URL_Site1}}
WAIT SECONDS=5
SET !TIMEOUT_STEP 0
TAG POS=1 TYPE=A ATTR=TXT:*Terms<SP>of<SP>Service* EXTRACT=TXT
'popup window will appear if page doesnt load and then it will be refreshed
SET !VAR1 EVAL("var text=\"{{!EXTRACT}}\"; if(text==\"#EANF#\") text = \"YES\";else text = \"NO\";text;")
SET !EXTRACT_TEST_POPUP {{!VAR1}}
TAG POS=1 TYPE=A ATTR=TXT:*Terms<SP>of<SP>Service* EXTRACT=TXT
SET URL_Refresh EVAL("var s='{{!EXTRACT}}'; var u='{{URL_Site1}}'; var x; if(s=='#EANF#'){x=u;} else {x='';}; x;")
SET EXTRACT NULL

WAIT SECONDS=2
URL GOTO={{URL_Refresh}}
Yep, very good...! :D

Creative Solution with the Conditional '!EXTRACT_TEST_POPUP', ah-ah...! :wink:

There are other Solutions for a 'Conditional 'PROMPT'' or a 'Conditional 'PAUSE'', but this one is as good, I would think..., can be seen as a "Shortcut" if you actually want to display the 'EXTRACT' in the 'PROMPT'...

And it might actually come in handy with v10.0.2 for FF, the 'PROMPT' Command/Functionality is a bit Buggy in that Version, maybe the '!EXTRACT_TEST_POPUP' could be some interesting Workaround in some cases, ah-ah...!

Oh-oh...!, but watch out that the 'TEST_POPUP' won't appear if you loop your Script, ah-ah...! :!:
(The Reload will still take place if needed, but you won't be notified by the Popup...)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
cjseriy
Posts: 16
Joined: Wed Jul 04, 2018 12:53 pm

Re: IF Page exceeds Timeout --> run URL GOTO= again

Post by cjseriy » Mon Jul 09, 2018 10:12 pm

chivracq wrote: Oh-oh...!, but watch out that the 'TEST_POPUP' won't appear if you loop your Script, ah-ah...! :!:
(The Reload will still take place if needed, but you won't be notified by the Popup...)
Hum, is there a way to pause a script if you loop it?
chivracq
Posts: 8535
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: IF Page exceeds Timeout --> run URL GOTO= again

Post by chivracq » Mon Jul 09, 2018 10:16 pm

cjseriy wrote:
chivracq wrote: Oh-oh...!, but watch out that the 'TEST_POPUP' won't appear if you loop your Script, ah-ah...! :!:
(The Reload will still take place if needed, but you won't be notified by the Popup...)
Hum, is there a way to pause a script if you loop it?
Yep..., the "Conditional 'PAUSE'", ah-ah...! :wink:

Or the "Conditional 'PROMPT'" as well, and a 'PROMPT' is "visually" more euh... visual...! :wink: , but the 'PAUSE' is easier...

(Same Principle like you used to toggle 'YES'/'NO' for '!EXTRACT_TEST_POPUP', but for '!SINGLESTEP'..., ah-ah...! :wink: )

And both can also be combined with a "Conditional Sound", quite funny as well... :idea:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
cjseriy
Posts: 16
Joined: Wed Jul 04, 2018 12:53 pm

Re: IF Page exceeds Timeout --> run URL GOTO= again [SOLVED]

Post by cjseriy » Tue Jul 10, 2018 11:01 am

Oh, that's great! That's what I was looking for :)
Thank you for all the support you are providing for iMacros community. It is really a valuable contribution!
chivracq
Posts: 8535
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: IF Page exceeds Timeout --> run URL GOTO= again [SOLVED]

Post by chivracq » Tue Jul 10, 2018 1:40 pm

cjseriy wrote:Oh, that's great! That's what I was looking for :)
Thank you for all the support you are providing for iMacros community. It is really a valuable contribution!
Ah-ah...!, you're welcome...! :D

(I always like answering "Interesting" Questions, ah-ah...! :wink: )
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply