camme/webdriverjs — pull request #122 by christian-bromann (2013-12-13 16:12:34+00:00)
Title: Implemented small selector API for better element querying

In the current version of WebdriverJS the user is restricted in the use of the different strategies the selenium server is able to query an element. The most commands are using the CSS selector. With this patch I enabled the use of all strategies for all commands. The following selector types will be supported:

- **CSS3 query selector**

e.g. `.myClass`, `#someID`, `div[attributeName="value"]` etc.
- **link text**

To get a anchor element with a specific text in it (f.i. `WebdriverJS`)
query the text starting with an equal (=) sign. In this example use `=WebdriverJS`
- **partial link text**

To find a anchor element whose visible text partially matches your search value, query it by using `*=`
in front of the query string (e.g. `*=driver`)
- **tag name**

To query an element with a specific tag name use `` or ``
- **name attribute**

For quering elements with a specific name attribute you can eather use a normal CSS3 selector or the
provided name strategy from the JsonWireProtocol by passing something like `[name="some-name"]` as
selector parameter
- **xPath**

It is also possible to query elements via a specific xPath. The selector has to have a format like
for example `//BODY/DIV[6]/DIV[1]/SPAN[1]`

I even can imagine to go one step further and enable selector types like `:last` or `:nth`.