jarib/watir-webdriver — Issue #114: Inconsistent behavior for :class selector
Author: ragnard
Created: 2012-01-12 10:32:23+00:00
State: open

When locating elements using the `:class` selector, the behavior is different depending on whether I use `element` or a specific tag, like `div`. For `element`, it locates succesfully if the given class occurs within the class attribute, but for `div` it only locates successfully if the given value is an exact match for the entire class attribute.

I have created a an example gist at https://gist.github.com/1599715 demonstrating this behaviour.

I would expect the locator to behave in the same way, regardless of the type (tag) of the elment I'm trying to locate.

This is slightly related to issue #36. I have made a local fork and fix for this, which makes :class always locate succesfully if the given value occurs as a class in the class attribute. Personally, I think this is the most useful behaviour, given the semantics of the `class` attribute.