Imacros to automate magento checkout using paypal express

Posted by Damodar Bashyal on January 08, 2015

 

I had heard about imacros but never tried. This time I wanted to give it a go as I need to proceed to through checkout process few times and watch the log. So, to do this repetitive task, I installed imacros extension on google chrome and recorded checkout process from beginning to end.

Even though imacros records most of the events, it didn't record form input filled and was not waiting for page to finish loading before moving to next step.

This is my last script that worked 99% of the time.

VERSION BUILD=8070701 RECORDER=CR
SET !ERRORIGNORE YES
' set max timeout for pages, default is 60 seconds
SET !TIMEOUT_PAGE 5
URL GOTO=chrome://newtab/
' go to cart page and empty previous basket
URL GOTO=http://au.dse.dev/checkout/cart/
TAG POS=2 TYPE=SPAN ATTR=TXT:Clear<SP>Shopping<SP>Cart
' wait 2 seconds, so cart items get cleared out
WAIT SECONDS=3
' now go to product page and select option and add to cart
URL GOTO=http://au.dse.dev/simple-with-warranty-wrnty-dsau-yg10480forza
WAIT SECONDS=2
TAG POS=1 TYPE=SELECT FORM=ID:product_addtocart_form ATTR=ID:warranty CONTENT=737
TAG POS=1 TYPE=BUTTON FORM=ID:product_addtocart_form ATTR=ID:productview_17742
WAIT SECONDS=2
TAG POS=1 TYPE=SELECT FORM=ID:product_addtocart_form ATTR=ID:warranty CONTENT=%
TAG POS=1 TYPE=BUTTON FORM=ID:product_addtocart_form ATTR=ID:productview_17742
' go to cart page
WAIT SECONDS=2
TAG POS=1 TYPE=SPAN ATTR=TXT:View<SP>Your<SP>Cart<SP>or<SP>Checkout
' wait 5 seconds before next action so page is fully ready
WAIT SECONDS=5
TAG POS=1 TYPE=INPUT:RADIO FORM=ID:shopping_cart_form ATTR=ID:17742
TAG POS=1 TYPE=INPUT:RADIO FORM=ID:shopping_cart_form ATTR=ID:17737
' wait 1 second then click on proceed to checkout button
WAIT SECONDS=1
TAG POS=1 TYPE=SPAN ATTR=TXT:Proceed<SP>to<SP>Checkout
' wait 5 seconds until checkout page is fully loaded then, select billing address and continue
WAIT SECONDS=5
TAG POS=1 TYPE=INPUT:RADIO FORM=ID:co-billing-form ATTR=ID:billing:use_for_shipping_yes
TAG POS=2 TYPE=SPAN ATTR=TXT:Continue
' select paypal as payment method
WAIT SECONDS=2
TAG POS=1 TYPE=INPUT:RADIO FORM=ID:co-payment-form ATTR=ID:p_method_paypal_express
TAG POS=6 TYPE=SPAN ATTR=TXT:Continue
WAIT SECONDS=15
' fill in paypal details and login
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:parentForm ATTR=ID:login_email [email protected]
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:parentForm ATTR=ID:login_password CONTENT=pa**w*rd
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:parentForm ATTR=ID:submitLogin
WAIT SECONDS=10
' accept payment authorisation and continue on paypal to return back to site to finalise order
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:parentForm ATTR=ID:continue_abovefold
WAIT SECONDS=15
' accept terms and condition and update data
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ID:order_review_form ATTR=ID:cnc-agreements CONTENT=YES
WAIT SECONDS=1
TAG POS=2 TYPE=SPAN ATTR=TXT:Update<SP>Order<SP>Data
WAIT SECONDS=2
' Once place order button is active, click on it to finalise order placement.
TAG POS=2 TYPE=SPAN ATTR=TXT:Place<SP>Order
' Click imacros play button and watch the process and enjoy ;)

You need to change IDs and paypal login details.

 
not published on website


QR Code: Imacros to automate magento checkout using paypal express