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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:53:50+00:00 2026-06-13T22:53:50+00:00

How can i write rspec testing for Iframe content? my Iframe look like <iframe

  • 0

How can i write rspec testing for Iframe content? my Iframe look like

<iframe src="/any url" name="Original">
   ...
   <div>test </div>
</iframe>

in between iframe whatever content, I want to write rspec test case for that content. How can i do ?

how can i check “test” is in iframe using rspec ? I write below but not pass

page.should have_content("test")

error like

Failure/Error: page.should have_content("test")
       expected there to be content "test" in "Customize .... 

I use capybara – 1.1.2 and rspec – 2.11.0 and rails 3.2.8

  • 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-13T22:53:51+00:00Added an answer on June 13, 2026 at 10:53 pm

    Following one works with selenium driver, possibly with other drivers too, but not for rack_test.

    /index.html:

    <!DOCTYPE html>
    <html>
      <body>
        <h1>Header</h1>
        <iframe src="/iframer" id='ident' name='pretty_name'></iframe>
      </body>
    </html>
    

    /iframer.html:

    <!DOCTYPE html>
    <html>
      <body>
        <h3>Inner Header</h3>
      </body>
    </html>
    

    spec:

    visit "/"
    page.should have_selector 'h1'
    page.should have_selector 'iframe'
    
    page.within_frame 'ident' do
      page.should have_selector 'h3'
      page.should have_no_selector 'h1'
    end
    
    page.within_frame 'pretty_name' do
      page.should have_selector 'h3'
      page.should have_no_selector 'h1'
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I write an Rspec test for the following? Using TDD, I want
Can someone please explain how you can write a url pattern and view that
In C++ one can write any of the following statements: 10; true; someConstant; //if
So I know I can write my own HTML-encoding function like this: function getHTMLEncode(t)
I am learning how to write test cases using Rspec. I have a simple
I'm new in rspec, write rspec-test for View and there's a problem: test fails
I'm writing a test app using the twitter gem and I'd like to write
I'm using Rspec and Capybara. How can I write a step to click on
I'm trying to write an rspec for my Rooms controller to test permissions with
I'm using Rspec and Capybara. How can I write a step to check a

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.