In a previous script step, I updated the Previous Year Sales and am trying to confirm that the Gross Margin Dollar was correctly auto-updated to 650000. I am getting an error that watir is :
unable to locate element using id => "GrossMarginDollar", :tag_name => "input".
In a previous question, there was an answer that if there are multiple same-name elements, in this case span3
, that watir picks the first one in the html, not the first one visible. If this is the problem, how can I specify which
span3
to use? If this isn't the issue, what should I be using to confirm the value was updated?
Here is the watir script:
confirm = browser.div(:id => "target_modal").div(:class => "modal-body").div(:class => "row").div(:class => "span3").input(:id => "GrossMarginDollar")
puts confirm.value.include? '650000'
Here is the html:
<div class="row">
<div class="span3">
<label for="FirstName">First Name</label>
<input id="FirstName" type="text" data-bind="value:FirstName" />
<label for="LastName">Last Name</label>
<input id="LastName" type="text" data-bind="value: LastName" />
<label for="Email">Email</label>
<input id="Email" type="text" data-bind="value: Email" />
</select>
</div>
<div class="span1"></div>
<div class="span3">
<label for="PreviousYearSales">Previous Year Sales</label>
<input id="PreviousYearSales" type="text" data-bind="value: PreviousYearSales" />
<label for="GrossMarginDollar">Gross Margin Dollar</label>
<input id="GrossMarginDollar" type="text" data-bind="value: GrossMarginDollar" />
</div>
</div>