mouse click automation

Larry Martell larry.martell at gmail.com
Tue Jan 1 14:36:46 EST 2019


On Tue, Jan 1, 2019 at 12:10 PM Siddha 2305 <siddha2305 at gmail.com> wrote:
>
> 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)

I have done this work both Selenium and Cypress. Check those out.



More information about the Python-list mailing list