DEV Community

Discussion on: WebDriver vs Chrome DevTools (Speed Test)

Collapse
 
klamping profile image
Kevin Lamping

This is a neat little exercise! I keep trying to think of ways to make it faster, but haven't had any success. I was able to switch to using a CSS-based selector targeting off the 'z-index', but it didn't seem to improve speeds at all. I've heard that xpath is slower than CSS, so I was hopefuly, but seems like it didn't matter that much in this circumstance.

Collapse
 
pjcalvo profile image
Pablo Calvo

Hi @kevin , thanks for commenting out. Yeah I have also heard that xpath strategy is slower than css. But so far it is like a myth, everybody believes it but nobody has seen it.

I think it actually depends on the complexity of the website DOM, but mostly on the xpath strategy: complicated locators with text validations sounds like they might decrease performance. (Not sure until I do an experiment).

Also, I was able to successfully beat the score on this post by injecting the javascript which locates (using javascript xpath locate function) and dispatches the click event using webdriverIO. At some point the execution was faster than the actual website response, so I don't think there can be a faster response.

Check out the code. gist.github.com/pjcalvo/6875f07ec6...

And the score dev-to-uploads.s3.amazonaws.com/i/...

Collapse
 
klamping profile image
Kevin Lamping

You read my mind on using browser.execute to trigger the tap event. I was trying that last night, but couldn't get it to trigger the event on the right element. Nice work figuring it out!

And yeah, I don't think that score is going to be beaten, aside from completely cheating and just bypassing the clicking all together and somehow triggering the "completion" function.