I am trying to fill in the date field on a web page with the following using Capybara:
<div class="activity--history-custom-dates-filter-container">
<label class="activity--header-element-label">From </label>
<input class="activity--history-custom-date-field
fid-datepicker--input activity-- history-custom-date-from-field hasDatepicker"
placeholder="mm/dd/yyyy" id="dp1416484110853">
<button class="activity--calendar-button"></button>
</div>
I can get to the parent div with the following:
within :xpath, "//label[text()='From ']/.." do
fill_in ????, with: period.first.american
end
I would like to fill in the input field with the date as shown, but I can't seem to find the right 'locator' (shown as ????) as the first argument to fill_in. The id is generated programmaticly so it changes on each visit to the page, so that's not acceptable.
The Capybara docs describe fill_in as follows:
"Locate a text field or text area and fill it in with the given text The field can be found via its name, id or label text."
Apparently, 'name' here means any text associated with the node, not the name of the element 'input' here.
I'm at a loss as to how to proceed. Any ideas?