How to refresh site until it loads completely

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
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
kogen
Posts: 1
Joined: Sun Sep 25, 2022 1:42 pm

How to refresh site until it loads completely

Post by kogen » Sun Sep 25, 2022 1:46 pm

First of all, I am far from an expert when it comes to coding and have no experience at all, just trying to make something work here hehe

I'm running a macro on a site which clicks a button every 10-11 minutes but the problem is that the site sometimes doesn't load and therefore fails to click the button.
I've adressed the first problem that the macro stops by !SET ERRORIGNORE YES
But I'd like to keep the site refreshing until the button appears and then complete the macro.
The code looks like this:

1 SET !ERRORIGNORE YES
2 VERSION BUILD=1011 RECORDER=CR
3 SET !TIMEOUT_PAGE 120
4 URL GOTO=(MYURL)
5 SET !VAR1 EVAL("var xx=Math.floor(Math.random()*(660-615))+615; xx;")
6 WAIT SECONDS={{!VAR1}}
7 TAG POS=1 TYPE=SPAN ATTR=TXT:Send<SP>all
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to refresh site until it loads completely

Post by chivracq » Mon Sep 26, 2022 9:16 am

kogen wrote:
Sun Sep 25, 2022 1:46 pm
First of all, I am far from an expert when it comes to coding and have no experience at all, just trying to make something work here hehe

I'm running a macro on a site which clicks a button every 10-11 minutes but the problem is that the site sometimes doesn't load and therefore fails to click the button.
I've adressed the first problem that the macro stops by !SET ERRORIGNORE YES
But I'd like to keep the site refreshing until the button appears and then complete the macro.
The code looks like this:

Code: Select all

1	SET !ERRORIGNORE YES
2	VERSION BUILD=1011 RECORDER=CR
3	SET !TIMEOUT_PAGE 120
4	URL GOTO=(MYURL)
5	SET !VAR1 EVAL("var xx=Math.floor(Math.random()*(660-615))+615; xx;")
6	WAIT SECONDS={{!VAR1}}
7	TAG POS=1 TYPE=SPAN ATTR=TXT:Send<SP>all

Your Thread Title could use a Question Mark, you are not sharing a 'How-To'... :idea:

Script posted, perfect, but it's "usually" better to post your Script without the Line-Numbers as if "we" need to run/test your Script, we'll need to re-edit all Lines to remove those Line-Nb's + Indentation... :idea:

(F)CIM...! :mrgreen: (Read my Sig, and the Forum Rules maybe... :idea: )
=> FCI:

Code: Select all

iMacros for CR v10.1.1, 'Free'/'PE'/'Trial'...?, CR105...?, OS...?
>>>

What you want is a "Conditional Reload/Refresh"=> Terms to search the Forum, I've already posted several Solutions several times... :idea:
=> On `URL GOTO`, or with 'Ctrl^r' + `EVENT` Mode as you are on v10.1.1 for CR... (`EVENT` Mode not supported in v10.1.x for FF...)

And if you don't "come out" by yourself, (but I'll need your FCI to post a Solution, and you may want to "clean" your Script of all Line-Nb's... ), could you clarify if you only find out after the [10-11] Min that the Site/Page didn't load properly (because the Button doesn't appear...?, (the 'SPAN' with "Send all" is not a Button btw...)), then if it's a question of waiting "longer" and the Button will eventually appear, you could just add a long `!TIMEOUT_STEP` before clicking on that Button and iMacros will patiently wait for it, without needing the Reload :P , or do you already know within a few Seconds after the `URL GOTO` that the Page didn't load correctly...?, and you don't need to wait for the [10-11] Min before reloading the Page...
=> How do you "know" the Page didn't load correctly...? Does the Browser keep spinning, waiting for some (external) Script to load maybe, or are some HTML Elements missing on the Page, etc...?
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply