Skip to content

Pikaday with capybara

Sorenfu edited this page Mar 1, 2016 · 1 revision

Try this to pick a date with capybara

      page.execute_script %Q{ $('#tenant_occupation_date').trigger("click") } # activate pikaday
      page.execute_script %Q{ var clickEvent = document.createEvent ('MouseEvents') }
      page.execute_script %Q{ clickEvent.initEvent ('mousedown', true, true); }
      page.execute_script %Q{ $('.pika-next')[0].dispatchEvent(clickEvent) } # move one month forward
      page.execute_script %Q{ $("button.pika-day:contains('15')")[0].dispatchEvent(clickEvent) } # click on day 15
Clone this wiki locally