Chrome / Selenium appears to have a different format for some input types between locales. For example, the date picker (i.e. input type="date"
) for the is formatted as mm/dd/yyyy
for US and yyyy-mm-dd
for Canada. This makes it difficult to write specs that work on machines with different locales. For example:
find("input[type='date']").set("12/31/2016") # works for Canada, fails for America
find("input[type='date']").set("2017-12-31") # works for America, fails for Canada
Is it possible to configure Capybara / Selenium to use a specific locale / formatting for inputs? Alternatively is it possible to determine the format of an input via JS and replace with a page.execute_script
(setting to input.val(new Date(2016, 12, 31))
doesn't work)?