BlueM / cliclick

macOS CLI tool for emulating mouse and keyboard events
https://www.bluem.net
Other
1.59k stars 116 forks source link

Randomization #148

Closed Spritekin closed 2 years ago

Spritekin commented 2 years ago

In order to make it seems more natural, I would recommend some randomization function which allows simulating clicking in an area or waiting an extra delta time. For example to say "click in the current position" +-50 pixels around:

c:.r(50,50)

Or say... wait 5 seconds +- 1 second

w:5000r(1000)
BlueM commented 2 years ago

What purpose do you see in a more “natural” behavior? Especially regarding the randomization of coordinates, which seems pretty counterproductive to me, unless one is interested in random failures.

Spritekin commented 2 years ago

Hi,

I'm testing apps in an emulator running on my side. It clicks around running a cycle and all runs perfectly. However if all clicks are in the same positions then I can't find out abnormal situations. Humans don't click in the same locations and might click in other buttons which might lead to errors which is exactly what I would like to capture.

Yes it is possible to code every specific situation, but that would require coding an arbitrary number of test variations which I would like to avoid. Imagine this, I change the size of a button, if my test always clicks the same location it might still hit the correct place, but if its variable the same click might hit something else then I expect errors to appear.

I was reading the code and found where to place this new handling but I suck at ObjectiveC. Maybe I will read a bit about how to build and test your code then I can modify myself, but a bit busy right now.

Regards

Spritekin commented 2 years ago

I think I can build a script on the fly then pass to cliclick for execution. No need to handle this. Thanks!

BlueM commented 2 years ago

Great, I had the same thought.