How to find an element using Watir by inline css styles


Tags: css,ruby-on-rails-3,watir

Problem :

How can I find an element using it's inline style declaration?

Here's my attempt:

results = browser.div(:id => 'summon_panel')
                 .div(:class => 'tabs2_container')
                 .div(:class => 'pane_inner', :index => 4)
                 .div(:class => 'pagination_tabs_container')
                 .div(:style => 'display: block') # This is what I've added.
                 .divs(:class => 'rank')

And result:

Watir::Exception::UnknownObjectException (unable to locate element, using {:style=>"display: block", :tag_name=>"div"}): app/controllers/streams_controller.rb:61:in `saveranks'



Solution :

Copypasta at OP's request:

Is "display: block" the exact inline style on the element?


    CSS Howto..

    CSS: How to create a
  • with 100% width
  • How to show a message box on center of screen?

    In Wordpress how can I create a page which has 3 col-md-4 blocks in a container?

    How to have the cutout of a div at the bottom right with shadow to the left

    How to reverse a CSS3 hover transformation?

    How to enforce a min-width for a page (css)

    How to detect whether a browser has tap highlighting?

    How to add hanging indent to the labels of a checkbox customized with custom icons in CSS?

    How can I get two form fields side-by-side, with each legend above the field?

    How to blend an image with a solid colour in CSS?

    How should I convert this object from .PSD to HTML/CSS?

    How to write conditional css?

    How to force or bring vertical scroll bar to front in html css

    How to style nested element that is styled by its parent already

    How to make text stay in place regardless of the monitor size?

    How to put a
  • over an
    • How to add css and js files on node pages independent of the theme?

      How to let the user choose a page number?

      How to set background url for css files in thymeleaf?

      How to click on a link from the header and then go back with HTML, Javascript and CSS? [closed]

      How is better to do with CSS sprites [closed]

      Can't Figure Out How to Fix CSS Width

      How to disable fixed header on Mobile with CSS

      How to store a global variable in JQuery?

      How to change CSS when it's ng-disabled?

      How to disable button using jquery in materialize css

      How to make an element slide with the viewport as it scrolls?

      How do I make CSS take into account a sidebar with absolute positioning

      how to select image using css

      How do I vertically align text inside an anchor element, which is nested within an unordered list