DEV Community

Pablo Calvo
Pablo Calvo

Posted on

How to Click Faster Selenium vs The World Faster Clicker

Today I discovered that a guy named Jordan Hum is the world record holder for more clicks in 5 seconds, with an amazing score of 14 CPS which means 70 clicks in 5 seconds.

So I went to Click Speed Test and tried my self.

You’re a Rabbit! Well.. You Clicked with the speed of 9.6 CPS (Clicks per seconds). You made 48 Clicks in 5 Seconds.

Automating the clicks

I wondered how fast can selenium click? I am pretty sure that a selenium script can beat this guy, but let's make sure finding some results.

This is the script:

driver = webdriver.Chrome(DRIVER_LOCATION) #driver
driver.get("https://clickspeedtest.com/5-seconds.html")
print('Start clicking')
id = driver.find_element_by_id('clicker')
while True: # click for ever
  try:
    id.click() 
  except Exception as ex: # until it breaks
    print('Time is over')
    break

time.sleep(1) # results are slow
result = driver.find_element_by_css_selector('.times')
print(f'Result: {result.text}\n') 
driver.close()
Enter fullscreen mode Exit fullscreen mode

I executed it several times to find an average value, but basically this was the result:

Start clicking
Time is over
Result: 190 Clicks in 5 Seconds
Enter fullscreen mode Exit fullscreen mode

Let's learn something

I wanted to have a lesson learned out of this post, so I tried and tested a couple of myths:

1) The original script finds the element once and then uses that instance to execute the clicks. But what if we try to find the element inside the loop and click it right away driver.find_element_by_id('clicker').click().

The outcome is way slower clicking as expected:

Result: 137 Clicks in 5 Seconds
Enter fullscreen mode Exit fullscreen mode

2) We can try to use a javascript executor to performs the clicks instead of the click method:

javaScript = "document.getElementById('clicker').click();"
driver.execute_script(javaScript);
Enter fullscreen mode Exit fullscreen mode

My lesson learned for this case is that using javascript not always trigger the click event.

3) What if I use a headless browser? Does it makes any difference:

The result is (surprisingly for me) an average faster clicking:

Result: 216 Clicks in 5 Seconds
Enter fullscreen mode Exit fullscreen mode

I executed this a lot of times and in some cases it went down to ~170, but average was mostly faster.

Final thoughts

Maybe clicking this fast is not a normal use case for selenium, but knowing how to improve tests speed and performance can save some minutes of execution on large amounts of tests.

Suggestions on what else we can test?

cheers :) and remember to keep clicking
https://pjcalvo.github.com

if you liked the post:

Buy Me A Coffee

Discussion (10)

Collapse
awguo profile image
John • Edited on

It works with arealme cps test and I just got Falcon. Thanks!

arealme.com/click-speed-test/en/

Would be great if you could develop some script for hand eye coordination test. Link is on the above page.

dev-to-uploads.s3.amazonaws.com/up...

Collapse
clicktests profile image
ClickTests

I try Selenium code to click on clicktests.com but they show auto clicker detected and my score are not added in their leaderboard. Can Anyone tell me how can i use selenium on clicktests.com.

Collapse
brettcooperr profile image
Brett Cooper

The world record of the world's fastest clicker is now updated on clickspersecond.com. The record holder's name is Joseph Garrett from England with an amazing speed of 23 CPS.

You can achieve this speed with some proper practice and correct techniques. I have listed five of the most important tips to help you increase your clicks per second rate.

Let me know what you think in the comments and if you have any questions.

Collapse
anytuna9 profile image
Kallan Ey Ey

made an account just to say, the website is filled of fake world records. As a member of the minecraft community, there is people such as kahzuk who could get 17 for 5 seconds. Even i beat the claimed 1 second world record as a random

Collapse
coresdual profile image
DualCores • Edited on
Collapse
rickrdough profile image
rick-r-dough • Edited on
Collapse
gvrjay profile image
gvrjay

Actually the website is fake....the information given about the world record is not official at all. There is a wide variety of clickers who even get cps above 20! Plus, it also depends on what mouse you are using. Some mice can double click causing the cps to be twice the number. So there is no official record.

Collapse
ignasvenckus20 profile image
youmom • Edited on

my not cuz helped autoclickdev-to-uploads.s3.amazonaws.com/uploads/articles/uvhe7hsnvf00njxhapun.ing

Collapse
asad_ali_7a6d163088861b2b profile image
Asad Ali

i beat the world record of 15.8 clicks or 79 clicks in 5 seconds

Collapse
pjcalvo profile image
Pablo Calvo Author

Niceee. Is it official???