msshd wrote: ↑Thu Oct 31, 2019 2:45 pm
Corrected as required! Now waiting for help
Okay..., perfect...! Now I can "start" answering your Thread...
Even if hum..., the Forum is a bit busy today, and I'm getting "a bit tired", and I haven't done "anything" for myself..., but OK, here we go...!
Well, I'll first start by quoting your previous Post...:
msshd wrote: ↑Thu Oct 31, 2019 1:48 pm
Code: Select all
VERSION BUILD=1005
SET !TIMEOUT_STEP 0
SET !ERRORIGNORE YES
URL GOTO=My Link
TAG POS=1 TYPE=BUTTON ATTR=TXT:Order
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:loginForm ATTR=NAME:firstName CONTENT=John
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:loginForm ATTR=NAME:lastName CONTENT=Robinson
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:loginForm ATTR=NAME:userName CONTENT=John
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:loginForm ATTR=NAME:password CONTENT=123456
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:loginForm ATTR=NAME:PhoneNo CONTENT=0771555555
'the following delay is not perfect as we have some time which lose for above tags
WAIT SECONDS=30
TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=ID:Login
Well I have removed my question from SOF! Regarding my questions, First of all I will click on a button which is a order link. After the page load I have a form which I have to fill out the form and submit it to the server. As the server count the click on the first button and the second one as it does not allow us to submit the form less than 30 seconds! (They thought that if make a delay in these button human also can fill the form and submit it beside the robot!). Indeed if I click on the login button on the second page the server send me automatically to the first page and I have to do all this again and wait for 3 sec. As I mentioned I would like immediately when I got 30 seconds time distance between this two button submit the form to make my order done! I am a beginner in iMacros and do not know how to make this delay in the perfect way. I do not want to use WAIT SECONDS=30 as it is not a exactly and make it more than 30 seconds delay. May I have use !STOPWATCHTIME or STOPWACH something like this commands? Is the following codes works??
Code: Select all
.
.
.
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:loginForm ATTR=NAME:PhoneNo CONTENT=0771555555
SET !Var1 {{!STOPWATCHTIME}}
SET !VAR0 30
SET !VAR2 EVAL("var v0='{{!VAR0}}'; var v1='{{!VAR1}}'; var x,y,z; x=parseInt(v0); y=parseInt(v1); z=x-y; z;")
WAIT SECONDS={{!Var2}}
TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=ID:Login
Second problem which I have is that the button in the first page will appear in a specific time I would like to refresh the page until this appear. I do not know how to make a while loop or some things similar to resolve this. In other word I would like the macro run and refresh the page until gets the button order after that goes to the rest of line.
I will be more than happy and appropriated if you could kindly help and make my macro work as I would like!
Hum, OK, URL not posted, so I "rely" on your Explanations to understand how this Site "behaves", as it dictates how to implement the Functionality that you want in your Script...
So..., if I understood correctly, (you'll need to correct me if I state anything "wrong"), the 5 'INPUT' Fields
and the "Login" Button will only appear upon clicking on the "Order" Button/Link.
There is no 'while' Loop in "your" Version of iMacros v10.x for FF/CR, or you would need to use v8.9.7 for FF with a '.js' Script.
So your current Implementation with '!ERRORIGNORE' + '!TIMEOUT_STEP=0' is the correct Way-to-go.
Then "everything" turns around the 'WAIT'.
If the "Order" Button did not appear, you will want your Script to loop again, after maybe 5 Sec (?) to try again, and if the "Order" Button did appear and the Script has been able to fill in the 5 'INPUT' Fields, you want it to wait "exactly" 30 Sec before clicking on the "Login" Button.
=> That means you will have 2 Conditions for the (Conditional) 'WAIT'.
Excellent about '!STOPWATCHTIME', that's indeed one of the 2 Implementations I had in mind and that I had mentioned earlier.
The other one would be using '!NOW' in 'EVAL()' also, but '!STOPWATCHTIME' is already perfect, and you already get a Relative Time in Seconds.
Watch out in the Script you've posted, I see you are using '!VAR0', but I think in v10.0.5 for CR 'Free', that this Var is not supported in the 'Free' Version, and that you can only use '!VAR[1-3]'...
But I would expect that you get some RuntimeError if/when you try to run your Script, telling you that "!VAR0 is not supported..."...?
You can use 'PROMPT' to follow your Vars and to debug your Script...
But OK, once you get your '!VAR2' to work "correctly", that will be "good" for the Functionality for the Conditional 30 Sec before clicking on the "Login" Button. Now you need to add the Functionality for the Conditional "5 Sec" between 2 Loops for the Script to "try again" if the "Order" Button didn't appear...
To do that, I can think of several possible Implementations...
- One would be to use the 'EXTRACT' Mechanism to first check if the "Order" Button is present or not, before actually trying to click on it.
- Another one could be to use '!TIMEOUT_STEP=1' (instead of 0) on the 5 'INPUT' Fields (=> that will give you the same 5 Sec if those 5 Elements are not found), and to still use '!STOPWATCHTIME' for the Check in 'EVAL()'. If '!STOPWATCHTIME' is already >5 Sec (instead of a much shorter Value I expect if the "Order" Button is present), then you spit out a "0" for the 'WAIT', and the Script will loop again directly without waiting for another 25 Sec...
In both Cases, you'll need the "&&" and/or "||" Logical Operator(s) with an 'if/else' Condition in the 'EVAL()' for '!VAR2'. (Many Examples on the Forum...)
- (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...