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 3998944
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:35:32+00:00 2026-05-20T07:35:32+00:00

I seem to be having trouble testing the slick javascript things I do with

  • 0

I seem to be having trouble testing the slick javascript things I do with jQuery when using Capybara and Selenium. The expected behavior is for a form to be dynamically generated when a user clicks on the link “add resource”. Capybara will be able to click the link, but fails to recognize the new form elements (i.e. “resource[name]”).

Is there a way to reload the DOM for Capybara, or is there some element of this gem that I just haven’t learned of yet?

Thanks in advance!

==Edit==

Currently trying my luck with selenium’s:

wait_for_element 

method.

==Edit==

I keep getting an “undefined method ‘wait_for_element` for nill class” when attempting to do the following:

@selenium.wait_for_element

It appears that that specific method, or perhaps wait_for with a huge selector accessing the DOM element I expect is the correct course of action, but now trying to get the selenium session is starting to be a huge headache.

  • 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-20T07:35:33+00:00Added an answer on May 20, 2026 at 7:35 am

    I use the Webdriver based driver for Capybara in RSpec, which I configure and use like this and it will definitely handle JS and doesn’t need a reload of the dom. The key is using a wait_until and a condition that will be true when your AJAX response has finished.

    before(:each) do
      select_driver(example)  
      logout
      login('databanks') 
    end
    
     def select_driver(example)
       if example.metadata[:js]
        Capybara.current_driver = :selenium
      else
        Capybara.use_default_driver
      end
    end
    
    it "should let me delete a scenario", :js=>true do
        select("Mysite Search", :from=>'scenario_id')  
        wait_until{ page.has_content?('mysite_searchterms')}    
        click_on "delete"     
        wait_until{ !page.has_content?('mysite_searchterms')}   
        visit '/databanks'
        page.should_not have_content('Mysite Search')
      end
    

    I also figured out a hack to slow down webdriver last night, like this, if you want to watch things in slo-mo:

       #set a command delay
       require 'selenium-webdriver'
    
       module ::Selenium::WebDriver::Remote
         class Bridge
           def execute(*args)
             res = raw_execute(*args)['value']
             sleep 0.5
             res
           end
         end
       end  
    

    As someone else mentioned, if you are getting a timeout waiting for the element, you could look at upping this:

    Capybara.default_wait_time = 10
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble trying to manipulate music using buttons I can't seem to make
I seem to be having trouble with the linkify I am using in my
Im having trouble trying to post data correctly using jQuery/AJAX I have the following...
I am currently testing things for my app and I seem to be having
I seem to be having trouble using relative links to display buttons. They stick
I seem to be having trouble with my code. I need to say: if
This may be something common and trivial, but I seem to be having trouble
I'm having trouble with MySQL or Python and can't seem to isolate the problem.
I'm having trouble getting my head around algorithm analysis. I seem to be okay
I'm having trouble with my DatabaseConnection class. I cannot seem to get $dbUser or

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.