WebPagetest Forums
Test hostScripts with smileycookie - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: Private Instances (/forumdisplay.php?fid=12)
+--- Thread: Test hostScripts with smileycookie (/showthread.php?tid=12179)



Test hostScripts with smileycookie - wodaxia - 04-12-2013 06:59 PM

I hope I am in right places.

Recently I want to test similecookie performance. The test procedure is:
Go to http://www.smileycookie.com
Select from menu "Shop By Price"
Select menu item "$20.00 -$30.00";
Select Position dropdown and select Sort Product by "Sales Rank";
Click the first item on the page;
Enter QTY to "3"
Click "ADD TO BASKET"
Click "PROCEED TO CHECKOUT"

=================
I wrote scripts like:
logData 1
navigate http://www.smileycookie.com/

click innerText="$20.00 -$30.00"
//navigate http://www.smileycookie.com/shop-by-pric...hirty.html

navigate http://www.smileycookie.com/shop-by-pric...sales_rank

navigate http://www.smileycookie.com/travel-mug-c...asket.html
//click title="Travel Mug and Gourmet Sugar Cookie Gift Basket"
//click innerText="Travel Mug and Gourmet Sugar Cookie Gift Basket"
//clickAndWait id="name1"

//Enter QTY to "3"
setValue id=qty 3
//Click "ADD TO BASKET"
click className="button add-to-cart"

//Click "PROCEED TO CHECKOUT"
clickAndWait title="Proceed to Checkout"


The issue:
a) The homepage popups a dialog and block next click event.
b) Though popup is closed manually, the next click and clickAndWait with title/className/innerText seems still not work.
The test browser is FF.
Could anyone help me resolve this issues(a and b). Or correct me if any wrong in my scripts. Thanks


RE: Test hostScripts with smileycookie - pmeenan - 04-16-2013 03:38 AM

You can either use javascript or a click event to close the dialog. Using javascript with the exec and execAndWait commands is probably the easiest way to do it because you can debug your javascript locally using the firefox console and make sure the commands work before submitting a test script.


RE: Test hostScripts with smileycookie - wodaxia - 04-16-2013 06:11 PM

Is 3rd party Javascripts supported? If not, how can I simulate click event on DOM element?

In the sample:
navigate http://www.smileycookie.com/travel-mug-cookie-gift-basket.html
//click className="button add-to-cart"
execAndWait jQuery('input[class~="add-to-cart"]').trigger('click') //NEW
The corresponding DOM element is:
<input class="button add-to-cart" type="image" src="https://s3.amazonaws.com/clientinstalls/add-to-basket-orange-btn.png" style="clear: both; position: relative; left: 10px;">

I first tested "jQuery('input[class~="add-to-cart"]').trigger('click')" in Firefox console and it works, but exec(or execAndWait) jQuery('input[class~="add-to-cart"]').trigger('click') does not trigger click event when it is tested with WPT.
My question is whether jquery or other 3rd JS APIs is supported for exec invocation?
Thanks





(04-16-2013 03:38 AM)pmeenan Wrote:  You can either use javascript or a click event to close the dialog. Using javascript with the exec and execAndWait commands is probably the easiest way to do it because you can debug your javascript locally using the firefox console and make sure the commands work before submitting a test script.



RE: Test hostScripts with smileycookie - pmeenan - 04-16-2013 10:26 PM

If jQuery is loaded by the page then it should be available (though you may want a semicolon at the end of the command). The exec commands literally just execute the given javascript in the context of the page. I'll take a look in a bit with a private agent and see if I can see what the script is doing.