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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:24:17+00:00 2026-06-13T19:24:17+00:00

I am writing tests to test that both affirming and dismissing a conformation popup

  • 0

I am writing tests to test that both affirming and dismissing a conformation popup work. However, I get the error:

And I dismiss popup                                     # features/step_definitions/web_steps.rb:74
  undefined method `switch_to' for #<Capybara::RackTest::Browser:0xa6f0dec> (NoMethodError)
  ./features/step_definitions/web_steps.rb:75:in `/^I confirm popup$/'
  features/add_session.feature:121:in `And I confirm popup'

when running my tests.

The steps in my .features files look something like this:

And I press "Delete"
And I confirm popup

Within web_steps.rb, I have the following defined:

When /^I confirm popup$/ do
  #page.evaluate_script('window.confirm = function() { return true; }')
  #page.click('OK')
  page.driver.browser.switch_to.alert.accept
  #popup.confirm 
end

When /^I dismiss popup$/ do
  page.driver.browser.switch_to.alert.dismiss
  #page.evaluate_script('window.confirm = function() { return true; }')
  #page.click('Cancel')
  #popup.dismiss
end

I am using the prickle gem which I have included as follows in my Gemfile:

group :test do
  gem 'cucumber-rails'
  gem 'prickle'
end

And I added a couple lines to my Gemfile as outlined here to include prickle. I initially had it as World do, like they show on the github page, but that was giving me errors since World was being used twice (the other time in the cucumber library). Here are the lines I added to my env.rb file:

require 'prickle/capybara'    # require

module Prickle_helper
  include Capybara::DSL
  include Prickle::Capybara  # include  Prickle
end

World(Prickle_helper)

Any ideas as to what could be causing my errors? Thanks!

  • 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-06-13T19:24:19+00:00Added an answer on June 13, 2026 at 7:24 pm

    I was omitting the @javascript before the methods that I wanted to use selenium on. For example:

    @javascript
    Scenario: Delete the class
      Given I am on the home page
      And I press "Delete"
      And I confirm popup
      Then I am on the homepage
      And I should not see the deleted class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some difficulty writing some Unit Tests to test a custom ModelBinder that
I'm writing unit tests for a function that takes both an *args and a
I'm writing test code that needs to clean up the entities it creates when
I am writing a unit test that needs to access an image file that
I'm writing some test cases, and I've got a test case that is using
I am having some trouble with writing a unit test that checks my custom
I am writing a c# unit test that validates string properties for an ORM
I have a unit test that I am writing and have run into an
I'm writing a JUnit test for some code that produces an Excel file (which
I'm writing a jUnit test for a constructor that parses a String and then

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.