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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:32:01+00:00 2026-06-17T16:32:01+00:00

Users on web page don’t distinguish between button and link styled as button. Is

  • 0

Users on web page don’t distinguish between “button” and “link styled as button”.
Is there a way to add check whether a “button or link” is present on page?

For example Capybara has step:

page.should have_button('Click me')

which does not find links styled as buttons.

  • 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-17T16:32:03+00:00Added an answer on June 17, 2026 at 4:32 pm

    Updated answer (should matcher is deprecated in RSpec 3.0+):

    expect(page).to have_selector(:link_or_button, 'Click me')
    

    Before:

    page.should have_selector(:link_or_button, 'Click me')
    

    Followed from click_link_or_button which is defined here: https://github.com/jnicklas/capybara/blob/master/lib/capybara/node/actions.rb#L12

    def click_link_or_button(locator)
      find(:link_or_button, locator).click
    end
    alias_method :click_on, :click_link_or_button
    

    It calls a selector :link_or_button. This selector is defined here: https://github.com/jnicklas/capybara/blob/master/lib/capybara/selector.rb#L143

    Capybara.add_selector(:link_or_button) do
      label "link or button"
      xpath { |locator| XPath::HTML.link_or_button(locator) }
    end
    

    It calls this method: http://rdoc.info/github/jnicklas/xpath/XPath/HTML#link_or_button-instance_method

    # File 'lib/xpath/html.rb', line 33
    
    def link_or_button(locator)
      link(locator) + button(locator)
    end
    

    So i tried to check the presence of the selector and it worked:

    page.should have_selector(:link_or_button, 'Click me')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web page where users can see data from MongoDB on a
I am trying to set up a web page where trusted users can upload
I have a members site where users are given up to 7 web page
I have a requirement to allow users to open word document from web page
I want to create a web page where users can initiate a process, this
I'm trying to redirect users of a web page to one of two different
I have a web page that sends email to multiple users (online distribution list).
I have a web page with a tiny space for users to submit some
Hello I'm looking to create a web-page where users can play Gomoku live with
First high-level: I have a web page that will be showing correspondance between 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.