I cannot figure out a way to interact with the highlighted HTML:
When I click on a link, an interactive modal appears, which has a table to allow user to buy parts. Also, the modal has links that open up new sections within the modal.
I have tried to write step definitions but cannot get test to pass. See below for my (latest attempt) code:
When /^I click on the Buy icon of loan part selected$/ do
@browser.div(:id, 'modal_loan_parts_table').link(:text, 'Buy').click
end
The error I keep getting is element not located
. Can someone please direct me to enlightenment?
Here is the error that occured:
unable to locate element, using {:id=>"modal_loan_parts_table", :tag_name=>"div"} (Watir::Exception::UnknownObjectException)
./step_definitions/secondarymkt_buying_lp.rb:62:in `/^I click on the Buy icon of loan part selected$/'
secondarymkt_buying_lp.feature:27:in `When I cllick on the Buy icon of loan part selected'
Many Thanks Guys!
I found the solution without using xpath. Here is my code and it works:
When /^I click on the Buy icon of loan part selected$/ do
@browser.div(:id, 'details-ajax-modal').wait_until_present
@browser.div(:id, 'details-ajax-modal').exists?
@browser.link(:class, 'modal-buy').wait_until_present
@browser.link(:class, 'modal-buy').click
end
Many thanks to everyone.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.