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

Top comments (13)

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
 
yungrasher profile image
Aydan Stueart

My record is 23 CPS and I did 115 clicks in 5 seconds
Image description

Collapse
 
clicktests profile image
Pankaj Kumar • Edited

I tried Selenium code to click on clickspersecond.com but they show auto clicker detected and my score is not added in their leaderboard. How can I use selenium on clickspersecond.com?

Collapse
 
awguo profile image
John • Edited

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
 
elsasmith23 profile image
Elsa Smith • Edited

It's fascinating to explore the world of clicking speed and automation. The world record holder's achievement in click tests is truly impressive, showcasing incredible dexterity. Your experiment with Selenium to automate clicks is intriguing.

While Selenium can achieve impressive results in click tests, it's important to consider the practicality and purpose of such high clicking speeds. Nonetheless, understanding ways to enhance test speed and performance is valuable, especially when dealing with large test suites.

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
 
rickrdough profile image
rick-r-dough • Edited
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
 
coresdual profile image
DualCores • Edited
Collapse
 
zeeshankarimi profile image
ズィシャーン カリミ

I took the Fastest Mouse Clicks in 5 Seconds Challenge and clicked 72 times in 5 seconds at a rate of 14.4 clicks per second. Here's the video link:
youtu.be/xQHr2i-Y-A4

Collapse
 
ignasvenckus20 profile image
youmom • Edited

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

Some comments may only be visible to logged-in visitors. Sign in to view all comments.