setting datetime-local fields #590
Unanswered
superchris
asked this question in
Q&A
Replies: 1 comment
-
|
I did some testing, and it should work if you send the exact keys that you would use to interact with the element test "works for a datetime-local input type", %{page: page} do
datetime_selector = Query.text_field("DateTime Local")
datetime = "10102020\t0100p"
page
|> fill_in(datetime_selector, with: datetime)
|> has_value?(datetime_selector, "2020-10-10T13:00")
endwith the page having <label>
DateTime Local
<input type="datetime-local" id="datetime-local" name="datetime-local">
</label>i found this stack overflow page which helped me figure this out: https://stackoverflow.com/questions/40304521/how-to-fill-in-a-datetime-local-field-with-capybara#40309938 We can probably improve this functionality by letting the user say test "works for a datetime-local input type", %{page: page} do
datetime_selector = Query.text_field("DateTime Local")
page
|> fill_in(datetime_selector, with: ~N[2020-10-10 01:00:00])
|> has_value?(datetime_selector, "2020-10-10T13:00")
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I ran into an issue trying to use fill_in with an
<input type="datetime-local"/>field. Using the normal fill_in with any combination of values didn't seem to work for me. Usingsend_keysalso didn't seem to correctly interact with the field. Here's what I ended up doing, which worked but didn't seem awesome. Putting this here in case anyone else runs into this or has a better idea:Beta Was this translation helpful? Give feedback.
All reactions