Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6965355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:03:06+00:00 2026-05-27T16:03:06+00:00

My page has a jquery ui datepicker on an input field #graph_start_date I’m trying

  • 0

My page has a jquery ui datepicker on an input field #graph_start_date

I’m trying to write the following Cucumber steps

When I click the graph start date
Then I should see a datepicker

Here’s what I have for the step definitions:

When /I click the graph start date/ do
  find(".//*[@id='graph_start_date']").click
end

Then /^I should see a datepicker$/ do
  page.should have_xpath(".//div[@id='ui-datepicker-div' and ?????????]")
end

The jquery ui datepicker initially inserts into the dom

<div class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible" id="ui-datepicker-div"></div>

When its popped up the dom contains

<div class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible" id="ui-datepicker-div" style="position: absolute; top: 523px; left: 167.5px; z-index: 1;">

After its dismissed the dom contains

<div class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible" id="ui-datepicker-div" style="position: absolute; top: 523px; left: 167.5px; z-index: 1; display: none;">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:03:06+00:00Added an answer on May 27, 2026 at 4:03 pm

    There is the :visible => true option which is documented in Capybara::Node::Matchers#has_xpath? so:

    Then /^I should see a datepicker$/ do
      page.should have_xpath(".//div[@id='ui-datepicker-div']", :visible => true)
    end
    

    However, this may be a different problem but for me the datepicker does not appear at all when the capybara driven browser does not have focus, and so my test fails (sometimes)!

    EDIT:

    First of all it seems that the datepicker does not actually want a click on the field to trigger but a focus which unfortunately is unsupported by capybara’s selenium driver and it does not trigger when you trigger a click but the browser has no focus.

    The correct way to trigger the focus would be:

    find(".//div[@id='ui-datepicker-div']").trigger('focus')
    

    but that raises a Capybara::NotSupportedByDriverError 🙁

    To workaround you can use the hackish:

    When /I focus the graph start date/ do
      page.execute_script("$('#graph_start_date').focus()")
    end
    

    (thanks to: http://groups.google.com/group/ruby-capybara/msg/af6caeef01d978b0)

    There are various discussions and relevant issues on this in Google Groups:

    • http://groups.google.com/group/ruby-capybara/browse_thread/thread/64b96cb15cda3f36
    • http://groups.google.com/group/ruby-capybara/browse_thread/thread/e7e88b2d8ab3b61e
    • http://groups.google.com/group/ruby-capybara/browse_thread/thread/ebcdad1a084f57a8
    • http://code.google.com/p/selenium/issues/detail?id=543
    • http://code.google.com/p/selenium/issues/detail?id=157
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp:TextBox associated to a jquery DatePicker. This input has a onTextChangedEvent
I have been trying to make jquery datepicker plugin work on a content page
If a page has both JQuery and Prototype then I got conflict. There is
http://steph.net23.net/work.php here is my test link. This page has a jquery script in it
I created a page that has a JQuery based dialog using the standard JQuery
I have a page that has fields dynamically loaded via JQuery. It allows a
I have a simple jQuery code that runs on a web page that has
The Scenario Using jQuery, I have a page that has a popup overlay containing
Sample page: http://jsbin.com/ohuze/2 This is a simple jQuery UI Accordion. Each accordion panel has
I am using the datepicker control from jQuery-ui 1.8. from-date is a text input.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.