Think this will work, although there may be some better way of doing it. I was 
using watir-webdriver and firefox:

b.goto('http://www.proflowers.com')
b.text_field(:value => " Keyword / Item #").set "30046508"
b.div(:id, 'SearchContainer').image(:class, 'searchSubmit').click
b.image(:class, 'calendar_button').click
b.div(:class, "5_1_2013 weekday").click


You can use a Time object to format the class string in the last command to 
select the day you want. 

#8 days from now:
[56] pry(main)> t = Time.now + 691200
=> 2013-03-30 12:21:36 -0700

Then you can use the Time object's strftime method to format the modified time 
as a string in m_d_yyyy format. See 
http://ruby-doc.org/stdlib-1.9.3/libdoc/time/rdoc/Time.html for more info.
 




________________________________
 From: Mikey <[email protected]>
To: [email protected] 
Sent: Thursday, March 28, 2013 5:20 PM
Subject: [wtr-general] New at creating test automation using Watir: a few 
problems I can't solve
 

Hi,
I have new at Watir and though I have only been using it for about 3 or 4 
hours, I am very impressed. It looks very promising.
Anyway. I am trying to create an automated test to place an order on a 
e-commerce website.  I would say I am about 80% done.
There are 3 problems I have encountered so far and I can't figure out the 
answers:

I am using the website www.proflowers.com as a test site.

1) My script has a line to enter a product number in the search field on top 
(in the homepage):
browser.text_field(:value => " Keyword / Item #").set "30046508"


Problem is I can't get the script to click on the "Go" button to perform the 
search, I am guessing I have the element wrong. I was using:
browser.img(:src => 
"http://a1128.g.akamai.net/7/1128/497/0001/origin.prvd.com/siteimages/PIR100206_XmasTest_Search_v3_go.gif";).click


but that doesn't work.


2) On the product page 
(http://products.proflowers.com/flowers/100-Blooms-of-Spring-30046508?ref=CatalogPID&q=30046508&trackingpgroup=pid)
 my script has an action to click on the calendar:
browser.img(:src => 
"https://a248.e.akamai.net/7/248/497/0001/origin.prvd.com/Siteimages/icon_Calendar_DeliveryTime.gif";).click


A calendar overlay pops up. I want the script to be able to select a delivery 
date on the calendar that is 8 days from today. I just can't this to work.
I tried: browser.div(:id => 
"productDetailBody_deliveryCalendar_calendarDisplay_ctl05_ctl00_pnlDate").click
but without success


3) Finally once I have confirmed an order, I want the script to grab the Order 
ID displayed on the order confirmation page and write it down in a text file.
The order confirmation page looks like this below. I have also copied the HTML 
for this section of the page.

Thank you so much if you can help!!



Thank You – your order is confirmed.
Print Order ConfirmationYour Order Confirmation ID is: MTXHWA1JAEPT
You will receive a confirmation email at:  [email protected]  shortly. 


<div class="OrderSummary" id="OrderSummary">
   <div class="OrderSummaryHead PeekABooBugFix">
   Thank You – your order is confirmed. 
   </div>
   <div class="OrderSummaryBody PeekABooBugFix">            
   <div id="ctl00_OrderProcessPageBody_ctl01_pnPrintSingleProd" 
class="OrderDetailsPrintIcon">
   <a 
href="/OrderProcess/(S(kqoe0gc1cpq5qhb00eyzcz5v))/OrderConfirmedPrint.aspx?ref=CatalogPID&trackingpgroup=pid&pid=30046508&op=new&deliverydate=4%2f11%2f2013&flexShown=False&ShowGiftOptions=true&quantity=1&scAddItem=true&flexChosen=False&deliveryon=True&cobrand=pfc&selectedrelationshipID=653664&ssid=73&sidb=4zkpr3pwotsyquswo22xiqlm&LoadProductsFromSessionStore=true"
 target="_blank">Print Order Confirmation</a>
   </div>
   <div id="LogOut" class="OrderDetailsLogout">
   </div>
   Your Order Confirmation ID is: <strong><span 
id="ctl00_OrderProcessPageBody_ctl01_lbOrderID" 
class="orderConfirmationID">MTXHWA1JAEPT</span></strong><br>
   You will receive a confirmation email at:              
   <strong><span id="ctl00_OrderProcessPageBody_ctl01_lbEmailAddress" 
class="orderConfirmationEmail">[email protected]</span></strong>
    shortly.             
   <br>
   <div style="position:absolute; height:12px;"><div 
class="facebookLikeContainerOrderConfirmed"><div id="FBLikePF"><fb:like 
layout="button_count" data-send="false" 
href="http://www.facebook.com/Proflowers"; ref="fblike_pf_order_confirm" 
width="200" show_faces="false" data-action="like" data-size="medium" 
fb-xfbml-state="rendered" class="fb_edge_widget_with_comment 
fb_iframe_widget"><span style="height: 20px; width: 79px;"><iframe 
id="f37ed64094" name="fd0a19d9" scrolling="no" style="border: none; overflow: 
hidden; height: 20px; width: 79px;" title="Like this content on Facebook." 
class="fb_ltr"
 
src="https://www.facebook.com/plugins/like.php?api_key=181198931947730&locale=en_US&sdk=joey&ref=fblike_pf_order_confirm&channel_url=https%3A%2F%2Fs-static.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D20%23cb%3Dfe1efb3b8%26origin%3Dhttps%253A%252F%252Forders.proflowers.com%252Ff28d115eb%26domain%3Dorders.proflowers.com%26relation%3Dparent.parent&href=http%3A%2F%2Fwww.facebook.com%2FProflowers&node_type=link&width=200&layout=button_count&colorscheme=light&action=like&show_faces=false&send=false&extended_social_context=false";></iframe></span></fb:like></div></div></div><div
 class="facebooklikeText">Like us for great deals on future orders</div>        
                                                                     
   </div>
</div>



-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.
 
[email protected]
http://groups.google.com/group/watir-general
[email protected]
 
--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to