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

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
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
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