Random position Click action

Hi,
Im looking for random click(XClick) within selected area.

For example as a Command I choose: XClick and as a Target I select some button on website.

Everytime i run this script program click the button in his center.
How to do some random offset to make every new click in different position within this button area? Is it possible?

center

This is above script:

  "Commands": [
    {
      "Command": "open",
      "Target": "http://google.com",
      "Value": ""
    },
    {
      "Command": "XClick",
      "Target": "vncpcj_dpi_96.png",
      "Value": ""
    }
  ]
}

Here is a solution:

  • VisualAssert | vncpcj_dpi_96.png (your button, now the center xy are stored in !imagex and !imagey )
  • executeScript_Sandbox | return ${!imagex} + Math.floor((0.5-Math.random())*40) | x1 Add randomly up +/- 20px to the x-value
  • executeScript_Sandbox | return ${!imagey} + Math.floor((0.5-Math.random())*20) | y1 Add randomly up to +/- 10px to the y-value
  • XClick | x1,y1
2 Likes

It works, thank you :slight_smile: