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

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

Comments

Projects
None yet
2 participants
@geb-bot

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(By.id("test"))).selectByValue("N")

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

@geb-bot

This comment has been minimized.

geb-bot commented Sep 13, 2014

This issue relates to #306

@geb-bot geb-bot added the Improvement label Apr 12, 2015

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

@erdi

This comment has been minimized.

Member

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