Replacing cssQuery with Sizzle...

43 views
Skip to first unread message

Jason Huggins

unread,
Sep 1, 2010, 1:09:52 PM9/1/10
to selenium-...@googlegroups.com
Question:
Any objections to *how* I'll be replacing cssQuery with Sizzle?

Plan:
1) Editing htmlutils.js as outlined in this post -
http://updatepanel.net/2009/09/01/how-to-make-selenium-sizzle/
(But I'll edit htmlutils.js directly, and *not* do the edit via
user-extensions)
2) Replacing library import references from cssQuery to Sizzle

Issues:
The build(s) have been broken forever. :-(
1) How would I know if swapping cssQuery for Sizzle broke anything?
2) Which magic build incantation should I run to specifically test css stuff?


Related issue:
http://code.google.com/p/selenium/issues/detail?id=336

Opinionated history of this change:
1) Licensing issues are stupid.
2) cssQuery is LGPL.
3) Selenium uses cssQuery ( http://dean.edwards.name/my/cssQuery/ ).
4) Selenium is licensed as Apache2.
5) Some people think LGPL is incompatible with the Apache2 license.
6) To appease those people, we're removing cssQuery
7) Best replacement for cssQuery is Sizzle. ( http://sizzlejs.com/ )


\ hugs /

Frank Cohen

unread,
Sep 1, 2010, 1:15:27 PM9/1/10
to selenium-...@googlegroups.com
+1, no concerns. -Frank

--
You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
To post to this group, send email to selenium-...@googlegroups.com.
To unsubscribe from this group, send email to selenium-develo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-developers?hl=en.


--
Frank Cohen, http://www.PushToTest.com, phone 408 871 0122
PushToTest, the open-source test automation company
Twitter: fcohen, LinkedIn: Frank Cohen


Santiago Suarez Ordoñez

unread,
Sep 1, 2010, 1:28:36 PM9/1/10
to selenium-...@googlegroups.com
With all the tests out there currently using CSS locators, I'm thinking a direct replacement has big chances of breaking some tests and I'm sure people will complain.
OTOH, I'm more than happy to rewrite failing tests in the move to a more compatible, widely used and fast css engine.

The implementation seems correct and the changes should be simple. If the build has been broken for so long and fixing it would take days, possibly holding new features from getting out, I'd just go with it, do some sanity tests and wait for the early adopters to contribute with the testing. 

my 2 cents

Santi


David Burns

unread,
Sep 2, 2010, 6:14:11 AM9/2/10
to Selenium Developers
Sounds good to me.

+1

David
> > selenium-develo...@googlegroups.com<selenium-developers%2Bunsu bsc...@googlegroups.com>
> > .

Raja sankar

unread,
Sep 5, 2010, 1:50:44 AM9/5/10
to selenium-...@googlegroups.com
Hi,

If you're planning to include Sizzle, can you consider including jQuery? I am sure like me there are people will appreciate including this most used JS framework in to selenium. 

Thanks,
Rajasankar


--
You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
To post to this group, send email to selenium-...@googlegroups.com.
To unsubscribe from this group, send email to selenium-develo...@googlegroups.com.

Adam Goucher

unread,
Sep 5, 2010, 9:14:21 AM9/5/10
to selenium-...@googlegroups.com
The only thing Se needs from JQuery is the CSS location engine (Sizzle). Everything else is out of scope for a browser automation framework (Se).

-adam

David Burns

unread,
Sep 5, 2010, 10:18:10 AM9/5/10
to Selenium Developers
+1 for only needing Sizzle from JQuery.

Why would you need the rest of jQuery?

David
> >     <mailto:selenium-...@googlegroups.com>.
> >     To unsubscribe from this group, send email to
> >     selenium-develo...@googlegroups.com
> >     <mailto:selenium-developers%2Bunsu...@googlegroups.com>.

Patrick Lightbody

unread,
Sep 6, 2010, 3:10:38 PM9/6/10
to selenium-...@googlegroups.com
So would using sizzle let us use the full jQuery selector syntax
(including the stuff that goes way beyond CSS selectors)?

David Burns

unread,
Sep 6, 2010, 5:04:20 PM9/6/10
to Selenium Developers
Patrick,

It gives us all the locator stuff that jQuery has.

David

Patrick Lightbody

unread,
Sep 6, 2010, 5:05:09 PM9/6/10
to selenium-...@googlegroups.com
+1,000,000,000

Benjamin Hawkes-Lewis

unread,
Sep 6, 2010, 3:32:05 PM9/6/10
to selenium-...@googlegroups.com
On 6 Sep 2010, at 20:10, Patrick Lightbody wrote:

> So would using sizzle let us use the full jQuery selector syntax
> (including the stuff that goes way beyond CSS selectors)?

Sizzle supports the full JQuery selector syntax AFAIK. Note that only includes a subset of CSS3 selectors (as well as including selectors that are not part of CSS).

http://wiki.github.com/jeresig/sizzle/

http://ejohn.org/blog/selectors-that-people-actually-use/

--
Benjamin Hawkes-Lewis

Rajasankar

unread,
Sep 8, 2010, 6:57:15 AM9/8/10
to selenium-...@googlegroups.com
Adam,

I am using jQuery to locate the DOM elements easily. It is possible that it can be achieved in Se using XPath or CSS. However, for me it is simple and fast, considering that I need to test in all versions of IE and AUT elements are dynamic.

Repacking the selenium jar with jQuery is easier, however, if it is included that would be nice.

Rajasankar

pnewhook

unread,
Sep 8, 2010, 1:32:03 PM9/8/10
to Selenium Developers
Rajasankar, you are in fact using sizzle to locate the elements, not
jQuery. Sizzle is a core part of jQuery. Sizzle is the library that
handles the $("div#id:first-child) part of your jQuery statement. The
rest of jQuery handles Ajax, animations, etc. which selenium can't
use. I think you'll find your jQuery selectors work in Selenium with
this change. Just wait for the release.
> >>     <mailto:selenium-...@googlegroups.com>.
> >>     To unsubscribe from this group, send email to
> >>     selenium-develo...@googlegroups.com
> >>     <mailto:selenium-developers%2Bunsu...@googlegroups.com>.

Jason Huggins

unread,
Sep 8, 2010, 3:34:41 PM9/8/10
to selenium-...@googlegroups.com
On Wed, Sep 8, 2010 at 12:32 PM, pnewhook <peter....@gmail.com> wrote:
> Rajasankar, you are in fact using sizzle to locate the elements, not
> jQuery. Sizzle is a core part of jQuery. Sizzle is the library that
> handles the $("div#id:first-child) part of your jQuery statement.

I think for marketing purposes, we should just say "Selenium now
includes JQuery selector syntax (powered by Sizzle)"...

Also, related side-note, my Sizzle-related change in trunk is/was only
to the Selenium 1 (Core/RC/IDE) code-base... I didn't make any
WebDriver/Selenium2 related changes for doing jQuery/Sizzle lookups...

Perhaps Simon can weigh on what would be involved in "Atom"-ize CSS
lookups using jQuery/Sizzle?

\ hugs /

Rajasankar

unread,
Sep 8, 2010, 8:38:15 PM9/8/10
to selenium-...@googlegroups.com
Thanks for the clarification. I haven't used jQuery that much. Waiting
for the release.

Rajasankar

Simon Stewart

unread,
Sep 9, 2010, 5:28:13 PM9/9/10
to selenium-...@googlegroups.com

I'll need to have a look. Technically, the Right Thing to do would be
to include sizzle in the third_party part of the tree, then define it
as a "js_dep" and drag it on when necessary. That'll need me to jigger
around with the Javascript rules in CrazyFun, but it shouldn't be much
work. Once that's done, hooking it into the locators will be a doddle.

Simon

Reply all
Reply to author
Forward
0 new messages