8000 seleniumQuery Selectors · seleniumQuery/seleniumQuery Wiki · GitHub
[go: up one dir, main page]

Skip to content

seleniumQuery Selectors

Antônio "acdc" Jr edited this page Dec 17, 2017 · 1 revision

seleniumQuery supported selectors

seleniumQuery allows querying elements directly by:

  • CSS Selectors - $(".myClass"),
  • jQuery/Sizzle enhancements - $(".myClass:eq(3)"), $(".myClass:contains('My Text!')")
  • XPath - $("//div/*/label/preceding::*")
  • and even some own seleniumQuery selectors: $("#myOldDiv").is(":not(:present)").

Our aim is to implement all CSS3 and jQuery (Sizzle) extension selectors.

Currently, most selectors both from CSS3 and jQuery extensions are supported, but not all. E.g.:

It is worth noting that, in seleniumQuery, all CSS Selectors are translated to XPath before execution by the browser. This way, most of extended selectors won't result in a performance hit, as happens with jQuery. On the other hand, some may.

Below the jQuery selectors and, when applicable, comments about their support under seleniumQuery.

Selectors

Extra - seleniumQuery only selectors

  • :present - Matches all elements that are attached to the DOM. This is a very important property in Selenium page handling, as detached elements cannot be interacted with - they'd throw the infamous StaleElementReferenceException.

Unsupported selectors

They are only unsupported in the $(selector) constructor function. They are still available through the .is() function. That is, $("#x").is(":hidden") works as expected!

jQuery Extension

  • :animated Selector - Select all elements that are in the progress of an animation at the time the selector is run.
  • :focus - Selects element if it is currently focused.
  • :focusable - From jQuery UI. Selects elements which can be focused.
  • :hidden - Selects all elements that are hidden.
  • :tabbable - From jQuery UI. Selects elements which the user can focus via tabbing.
  • :visible - Selects all elements that are visible.

CSS3

  • :only-of-type - Selects all elements that have no siblings of the given type.
Clone this wiki locally
0