Current time: 12-07-2019, 11:49 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Test hostScripts with smileycookie
04-12-2013, 06:59 PM
Post: #1
Test hostScripts with smileycookie
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
Find all posts by this user
Quote this message in a reply
04-16-2013, 03:38 AM
Post: #2
RE: Test hostScripts with smileycookie
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
04-16-2013, 06:11 PM (This post was last modified: 04-16-2013 06:17 PM by wodaxia.)
Post: #3
RE: Test hostScripts with smileycookie
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-c...asket.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.
Find all posts by this user
Quote this message in a reply
04-16-2013, 10:26 PM
Post: #4
RE: Test hostScripts with smileycookie
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)