Issue with Adopting a puppy script from the Cucumber and Cheese book

53 views
Skip to first unread message

Al Baldwin

unread,
Feb 8, 2017, 10:25:31 AM2/8/17
to Cucumber and Cheese
require 'rubygems'
require 'watir'

browser = Watir::Browser.new :firefox

browser.goto 'http://puppies.herokuapp.com'

browser.button(:value => 'View Details').click
browser.button(:value => 'Adopt Me!').click
browser.button(:value => 'Complete the Adoption').click
browser.text_field(:id => 'order_name').set('Cheezy')
browser.text_field(:id => 'order_address').set('123 Main St')
browser.text_field(:id => 'order_email').set('che...@foo.com')
browser.select_list(:id => 'order_pay_type').select('Check')
browser.button(:value => 'Place Order').click

fail 'Browser text did not match expected value' unless browser.text.include? 'T\
hank you for adopting a puppy!'


The error:
This code has slept for the duration of the default timeout waiting for an Element to exist. If the test is still passing, consider using Element#exists? instead of rescuing UnknownObjectException
/Users/alanbaldwin/.rvm/gems/ruby-2.2.1/gems/watir-6.1.0/lib/watir/elements/element.rb:507:in `rescue in wait_for_exists': timed out after 30 seconds, waiting for {:id=>"order_address", :tag_name=>"input"} to be located (Watir::Exception::UnknownObjectException)

I can click/highlight the order_address text_box but i cant set values within the box. 

Mallikarjun Vempati

unread,
Oct 10, 2017, 12:54:00 PM10/10/17
to Cucumber and Cheese
I have observed the same issue and I guess issue is beacuse address text field doesnt have input tag in elements. Could some one help us on this ?

Brandon Ferguson

unread,
Oct 10, 2017, 2:09:31 PM10/10/17
to Cucumber and Cheese
For the order_address field, use the textarea method instead of the text_field method. 

“browser.textarea(id: 'order_address').set('123 Main St.')”

Mallikarjun Vempati

unread,
Oct 11, 2017, 7:10:00 AM10/11/17
to Cucumber and Cheese
Thank you
Reply all
Reply to author
Forward
0 new messages