mouse click automation

Siddha 2305 siddha2305 at gmail.com
Tue Jan 1 12:08:43 EST 2019


Hello All,

I am trying to write a script to emulate mouse clicks.
The script launches Google chrome, navigates to the website. But after that the script does not go to the specified coordinates. 

Also, I noticed that the screen coordinate is different every time I tried to check it.

Could someone please help me fix this?

PS : I am a complete beginner and this is my first attempt at this

from pynput.mouse import Button, Controller

import webbrowser

mouse = Controller()

chromedir= 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'

webbrowser.get(chromedir).open("https://lnkd.in/fT4AKq8")

time.sleep(30) # to let the link load

mouse.position = (43, 483) # everytime I tried to check the coordinates of the pace I wanted to do a left click, it was different.

mouse.click(Button.left, 1)



Thank you in advance.



More information about the Python-list mailing list