admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

Define "CSS Selector" Please #389

Closed iDVB closed 7 years ago

iDVB commented 9 years ago

I've looked all through the WD docs as well as the JSONWire and no one seems to define how in this case CSS Selectors should be formatted.

For instance, can I use pseudo classes as selectors? I'm confused as to how this is missed even in the issues seciton of Github. It looks to me like most people's examples and even the official examples are using elementByName or elementByClassName. Why would you want to use those over elementByCssSelector which seems rather intuitive, however I can't seem to get to work with any of the typical JQuery CSS Selectors?

sebv commented 9 years ago

Doc is here: https://selenium.googlecode.com/git/docs/api/py/selenium/selenium.selenium.html (Look for pseudo-class).

You can easily implement your own jQuery based selection logic, using execute and returning elements.

iDVB commented 9 years ago

Thanks! Would you have/know of an example of jQuery based selection logic, using execute?

sebv commented 9 years ago

https://github.com/admc/wd/blob/master/test/midway/api-exec-specs.js#L95 https://github.com/admc/wd/blob/master/test/midway/api-exec-specs.js#L112