Skip to content

Support Hierarchical CSS Selectors #390

Open
@diba1013

Description

Problem

When we encounter missing elements with the Unbreakable Selenium, we try to find the old element inside the golden master. Therefore, we query the By used and look what type was used (i.e. By.id, By.class).

However, when we try to find By.cssSelector, we currently only support simple css selectors. The supported selectors look for some known attributes like id or class. For example:

  • By.cssSelector( "#id" );
  • By.cssSelector( ".class" );

This should be the same for @FindBy.

Solution

We want to support hierarchical selectors. Note, that this issue should only address selectors that query the parent or its' children of the current element. It should not look for attributes on the current element. A complete specification of CSS selectors can be found in the CSS specification.

The current element would mean to selects any element (this also includes any * or no selector) and queries parent, children, state : or pseudo-element ::. Note that the state may only look at the elements' parent or children. Please refer to the examples below. Note that those examples are not complete, refer to the specification for more.

Examples this issue should address

  • div p
  • div > p
  • p~ul
  • p::before
  • p:nth-child(4)

Examples not considered for this issue (see #389)

  • a[target]
  • a[target=_blank
  • input:checked

Community

I kindly ask the community to provide examples below that should be reflected with this issue, so that we can use these to test the implementation.

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions