Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I haven't tried symbol interpolation, but the string interpolation should work. But, you many not need to do that... usually, this sort of thing can be solved by more closely modelling your website using sections. Instead of dynamically creating elements, you could use the <code>elements</code> or <code>sections</code> methods that will create arrays of elements. Here's what I'd do based the example you've given:</p> <p>I'm guessing from your example that your website lists passengers... if each passenger is displayed in a separate div then you could consider something like:</p> <pre><code>#section that models a single passenger class PassengerDetails &lt; SitePrism::Section element :first_name, "input[id^=passenger-first-name]" element :last_name, "input[^=passenger-last-name]" end #page that contains a list of passengers class FlightManifest &lt; SitePrism::Page sections :passengers, PassengerDetails, ".passenger-details" #... where ".passenger-details" is a style on the divs that contains a passenger's details end </code></pre> <p>Given the above, you could refer to the list of passengers as an array:</p> <pre><code>Then /^the flight manifest contains the correct first and last names for each passenger$/ do @flight_manifest.passengers.each_with_index do |passenger, i| passenger.first_name.text.should == @expected_passengers[i].first_name passenger.last_name.text.should == @expected_passengers[i].last_name end end </code></pre> <p>I don't know if that helps, or if it's possible with your website, but it might point you in the right direction...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload