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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:12:17+00:00 2026-06-17T17:12:17+00:00

In my page.rb, I’m using div(:select, :css => ‘div.active[style=display: block;]’) which is giving me

  • 0

In my page.rb, I’m using div(:select, :css => 'div.active[style="display: block;"]') which is giving me the error – Watir::Exception::MissingWayOfFindingObjectException.

In the console, document.querySelector("div.active[style='display: block;']") returns the object properly. I’m not too sure where to look in the documentation, so any help would be greatly appreciated.

Thanks in advance.

  • 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-17T17:12:18+00:00Added an answer on June 17, 2026 at 5:12 pm

    As far as I can tell from the page-object gem code, I do not believe that the page-object gem supports :css locators for watir-webdriver. At least it is not included in the watir_finders method – see element.rb and div.rb. I am guessing that the reason is due to watir-webdriver’s current limitation that :css locators can only be used when using the element method – see watir-webdriver’s issue 124.

    Solution 1 – Use a Block

    However, you could workaround these issues by defining the div in your page object with a block.

    Assuming the html:

    <div class="active" style='display: block;'>text</div>
    

    The following worked for me:

    div(:select){ browser.element(:css => 'div.active[style="display: block;"]') }
    

    Solution 2 – Use Xpath

    Alternatively, you could convert your css locator to an xpath locator:

    div(:select2, :xpath => '//div[@class="active" and @style="display: block;"]')
    

    Note that if you go this way, you might want to look at this other question, which talks about using a more robust locator for the class.

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

Sidebar

Related Questions

Page using: jquery-1.8.0.min.js and jquery-ui-1.8.23.custom.min.js $( '#d-select' ).click(function() { $.ajax({ type: 'POST', url: 'ajax.php',
page: http://jsbin.com/eniva4/edit I have one main div: #main-content which contains two div's : #announcement
Page has menu items that would replace a 'div id=foo_(current menu item)' with 'div
The page is here: https://gentle-day-3026.herokuapp.com/ The css file like this: https://gentle-day-3026.herokuapp.com/stylesheets/base.css another is to
My page loads a TextView which is scrollable. Unfortunately the position appears to stick
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
Page is loaded with a hidden select box in it. I click on a
This page , which implements a JavaScript-based online solver for Freecell, does not work

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.