Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find elements with an id, class or name derived By selector where possible #333

geb-bot opened this issue Sep 13, 2014 · 2 comments


Copy link

geb-bot commented Sep 13, 2014

Originally created by SergeyA.

Expressions like $("#myid").value("test") are about two times slower than their Selenium analog
new Select(driver.findElement("test"))).selectByValue("N")

I believe it is because all selectors are translated to By.cssSelector in NonEmptyNavigator.find without any optimizations by selector type.

Copy link

geb-bot commented Sep 13, 2014

This issue relates to #306

@erdi erdi changed the title $ function uses By.cssSelector even for simple selectors by id Find elements with an id, class or name derived By selector where possible Jul 6, 2015
Copy link

erdi commented Jul 6, 2015

I'm not sure that we should be getting into parsing css selectors as this is complex and best left to driver implementations. Given that, if you use a css selector ($("#myid")) a By.cssSelector() search will be performed.

The implementation has been changed to use an appropriate By selector when you use attributes for your search though - e.g. $(id: "myId"), $(name: "user"), $(class: "myClass") will not not perform a By.cssSelector() search anymore.

@erdi erdi self-assigned this Jul 6, 2015
@erdi erdi added this to the 0.10.1 milestone Jul 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants