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

  • Home
  • SEARCH
  • 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 228647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:41:59+00:00 2026-05-11T19:41:59+00:00

My selenium tests like to fails randomly. As an example I have this scenario

  • 0

My selenium tests like to fails randomly. As an example I have this scenario

Scenario: I should be able to edit a user
  Given I created a user with the login "test@example.com"
  And I am viewing the user with login "test@example.com"
  Then I should see "Edit this user"
  When I click "Edit this user"
  Then I should be editing the user with login "test@example.com"
  When I press "Update"
  Then I should be viewing the user with login "test@example.com"
  And I should see "User was successfully updated."

This, along with the others, work fine using the basic webrat :rails mode. In selenium, the line

Then I should be editing the user with login "test@example.com"

and

Then I should be viewing the user with login "test@example.com"

fail randomly, in that sometimes the first fails, other times the seconds fails. Using the website by hand results in the correct operation, and like I said, the webrat/rails mode works fine.

Rails 2.2.2
Cucumber 0.3.7
selenium 1.1.14 (fixed to work with FF3)

Some extra info:

Scenario: I should be able to edit a user                         # features/admin_priviledges.feature:26
  Given I created a user with the login "test@example.com"        # features/step_definitions/global_steps.rb:18
  And I am viewing the user with login "test@example.com"         # features/step_definitions/global_steps.rb:60
  Then I should see "Edit this user"                              # features/step_definitions/webrat_steps.rb:93
  When I click "Edit this user"                                   # features/step_definitions/webrat_steps.rb:18
  Then I should be editing the user with login "test@example.com" # features/step_definitions/global_steps.rb:66
    expected: "/users/8/edit",
         got: "/users/8" (using ==)
    Diff:
    @@ -1,2 +1,2 @@
    -/users/8/edit
    +/users/8
     (Spec::Expectations::ExpectationNotMetError)
    features/admin_priviledges.feature:31:in `Then I should be editing the user with login "test@example.com"'
  When I press "Update"                                           # features/step_definitions/webrat_steps.rb:14
  Then I should be viewing the user with login "test@example.com" # features/step_definitions/global_steps.rb:66
  And I should see "User was successfully updated." 

Then /^I should be (editing|viewing) the (\w+) with (\w+) "([^\"]*)"$/ do |action,model,field,value|
  func = make_func(action,model)
  m = find_model_by_field_and_value(model,field,value)
  URI.parse(current_url).path.should == eval("#{func}(m)")
end

Those are the relevant steps. The press “Update” one is a standard webrat step (click_button)

  • 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-11T19:41:59+00:00Added an answer on May 11, 2026 at 7:41 pm

    Changing a webrat step from

    When /^I press "([^\"]*)"$/ do |button|
      click_button(button)
    end
    

    to

    When /^I press "([^\"]*)"$/ do |button|
      click_button(button)
      selenium.wait_for_page_to_load
    end
    

    it works. Telling selenium to wait fixes!

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

Sidebar

Related Questions

I have a set of Selenium tests which run via HTTP - I'd like
Is it possible to create Selenium tests using the Firefox plugin that use randomly
I am writing some UI tests using Selenium and i have a JavaScript Tree
I am using PHPUnit 3.4.12 to drive my selenium tests. I'd like to be
I'm using TestNG to run Selenium based tests in Java. I have a bunch
I would like an automated web tests suite based on Selenium RC to take
We are running Selenium regression tests against our existing code base, and certain screens
I'm using selenium to run some functional tests on the UI for our current
I'm building some functional tests for a web site using Selenium, and I'm stuck
I'm using the Selenium Fitnesse Bridge Fixture in order to write tests in Fitnesse

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.