Page monitoring and script excecution

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
dubflakes
Posts: 4
Joined: Thu Aug 22, 2013 10:03 am

Page monitoring and script excecution

Post by dubflakes » Thu Aug 22, 2013 10:25 am

I'm sort of a novice to this so forgive any ignorance to nomenclature and the like.
I have been using Imacros for awhile and it has been working well for me, but there is a problem I can't seem to get around.
I use the program to automate cart systems on web sites to expedite purchases. The problem that I am facing is that one of the websites I use goes to an error page until the URL goes live. I have the URL ahead of time, but I'm wondering if there is a way I can
1. Loop through loading the URL (ignoring the error URL) until the page goes live
2. When page goes live execute the script based on "add to cart" function appearing

I was using a script similar to the following, but there are some conflicts with what I want to do.

VERSION BUILD=8300326 RECORDER=FX
TAB T=1
URL GOTO=https://www.website.com
SET !ERRORIGNORE YES
SET !TIMEOUT 4
TAG POS=1 TYPE=INPUT:BUTTON FORM=ID:add ATTR=NAME:Add&&VALUE:Add<SP>to<SP>Cart
TAG POS=1 TYPE=INPUT:BUTTON FORM=ID:recalculate ATTR=ID:Button7
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:checkoutform ATTR=NAME:Add22&&VALUE:Proceed<SP>to<SP>shipping<SP>calculation<SP>->
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:billing ATTR=NAME:B1&&VALUE:Check<SP>out

The above will loop quickly through the error page and continue to load until the page goes live(and "add to cart" button appears). The problem I face is setting the timeout. I need it low to loop the page quickly, but once it executes the checkout procedure the automation times out, because the website cannot load the pages as quicker then the timeout is set at.
Keep in mind that these products sell out in a matter of seconds, so efficiency and speed is key.

So I'm wondering if there is a workaround with what I'm using right now or if there is an entirely different process/script/function that I may not know about that will monitor the page independently of the timeout setting and execute the process when the URL goes live.

Thanks ahead of time for any help that you can provide.
chivracq
Posts: 8761
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Page monitoring and script excecution

Post by chivracq » Fri Aug 23, 2013 1:48 am

dubflakes wrote:I'm sort of a novice to this so forgive any ignorance to nomenclature and the like.
I have been using Imacros for awhile and it has been working well for me, but there is a problem I can't seem to get around.
I use the program to automate cart systems on web sites to expedite purchases. The problem that I am facing is that one of the websites I use goes to an error page until the URL goes live. I have the URL ahead of time, but I'm wondering if there is a way I can
1. Loop through loading the URL (ignoring the error URL) until the page goes live
2. When page goes live execute the script based on "add to cart" function appearing

I was using a script similar to the following, but there are some conflicts with what I want to do.

Code: Select all

VERSION BUILD=8300326 RECORDER=FX
TAB T=1
URL GOTO=https://www.website.com
SET !ERRORIGNORE YES
SET !TIMEOUT 4
TAG POS=1 TYPE=INPUT:BUTTON FORM=ID:add ATTR=NAME:Add&&VALUE:Add<SP>to<SP>Cart
TAG POS=1 TYPE=INPUT:BUTTON FORM=ID:recalculate ATTR=ID:Button7
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:checkoutform ATTR=NAME:Add22&&VALUE:Proceed<SP>to<SP>shipping<SP>calculation<SP>->
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:billing ATTR=NAME:B1&&VALUE:Check<SP>out
The above will loop quickly through the error page and continue to load until the page goes live(and "add to cart" button appears). The problem I face is setting the timeout. I need it low to loop the page quickly, but once it executes the checkout procedure the automation times out, because the website cannot load the pages as quicker then the timeout is set at.
Keep in mind that these products sell out in a matter of seconds, so efficiency and speed is key.

So I'm wondering if there is a workaround with what I'm using right now or if there is an entirely different process/script/function that I may not know about that will monitor the page independently of the timeout setting and execute the process when the URL goes live.

Thanks ahead of time for any help that you can provide.
Yeeees, TIMEOUT=4 is a bit short for a Web-Page to load, unless you are directly connected to the Web-Server, I would say...

I think I would optimize your Script like that:

Code: Select all

VERSION BUILD=8300326 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !TIMEOUT 20
SET !TIMEOUT_STEP 1
URL GOTO=https://www.website.com
TAG POS=1 TYPE=INPUT:BUTTON FORM=ID:add ATTR=NAME:Add&&VALUE:Add<SP>to<SP>Cart
TAG POS=1 TYPE=INPUT:BUTTON FORM=ID:recalculate ATTR=ID:Button7
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:checkoutform ATTR=NAME:Add22&&VALUE:Proceed<SP>to<SP>shipping<SP>calculation<SP>->
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:billing ATTR=NAME:B1&&VALUE:Check<SP>out
Your Page then has 20 sec to load, adjust accordingly to your connection..., and once loaded, will take 4 sec to go through the 4 steps and reload again...
Depending on which steps (among the 4 steps), load a new Page, but if they just fill in some value or check on stg on the page without requiring a new Page to be loaded, you can play with "SET !TIMEOUT 1 // SET !TIMEOUT 20" just before and just after the one or several steps in a row on the same Page... (You can win 3 sec!... out of 4! But the Page needs to load... and if any Button/s or Link/s on the Page load/s a new Page, it/they need/s to have the time to load as well...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply