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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:33:49+00:00 2026-05-16T16:33:49+00:00

We are running Webrat with Selenium2.0 aka WebDriver in our application. WebDriver handles page

  • 0

We are running Webrat with Selenium2.0 aka WebDriver in our application.

WebDriver handles page reloading very well and do not start next steps if the browser is reloading entire page. The problem is that this mechanism doesn’t work with Ajax requests. WebDriver doesn’t do any idle when there some after click() or change().

Can anyone suggest how to make webdriver idle until the end of all ajax requests on the page?

  • 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-16T16:33:49+00:00Added an answer on May 16, 2026 at 4:33 pm

    We ended up writing a layer over selenium that handled this scenario by wrapping the calls in an optional loop. So when you’d do:

    @browser.click "#my_button_id"
    

    it would do something similar to what AutomatedTester suggested above:

    class Browser
      def click(locator)
        wait_for_element(locator, :timeout => PAGE_EVENT_TIMEOUT)
        @selenium.click(locator)
      end
    
      def wait_for_element(locator, options)
        timeout = options[:timeout] || PAGE_LOAD_TIMEOUT
        selenium_locator = locator.clone
        expression = <<EOF 
          var element;
          try {
            element = selenium.browserbot.findElement('#{selenium_locator}');
          } catch(e) {
            element = null;
          };
          element != null;
    EOF
        begin
          selenium.wait_for_condition(expression, timeout)
        rescue ::Selenium::SeleniumException
          raise "Couldn't find element with locator '#{locator}' on the page: #{$!}.\nThe locator passed to selenium was '#{selenium_locator}'"
        end
      end
    end
    

    the wrapper also did other things, like allowing to search by the button/input label etc. (so the wrapper didn’t only exist for the timing issues, this was just one of the things we put in there.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running SQL Server 2008 (not R2). I have a few reports that have URLs
Running Rails 3.1.3... I'll use a simple example of nested associations (not sure if
I'm running into an issue where webrat can't see checkboxes. I have some code
Running a gwtp-sample-basic-spring app in Eclipse, I see the welcome page, but after some
I am running cucumber tests with Webrat in external mode that is using Selenium.
running git instaweb in my repository opens a page that says 403 Forbidden -
I am running rails 3.0.0, rspec-rails 2.0.0.beta.20, webrat 0.7.2.beta.1, cucumber-rails 0.3.2 I have this
I am getting an empty page as response when running the following RSpec test:
Running Solr on Tomcat 7 on Win 2008 Server. I am looping through a
Running my script through Devel::NYTProf showed that the following portion of code took up

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.