I was trying to write a Python script to move the cursor to delete browser history, but when it exits vscode the script stops. Is there a fix?

37 views Asked by At
from pynput.mouse import Button,Controller
import webbrowser
import time

mouse=Controller()

url = 'google.com'

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

mouse.position = (1500, 55)
mouse.press(Button.left)
mouse.release(Button.left)
mouse.position = (1400, 270)
mouse.press(Button.left)
mouse.release(Button.left)
#has now exited vscode and stopped running
mouse.position(1000,100)
mouse.press(Button.left)
mouse.release(Button.left)

#webbrowser.get(chrome_path).open(url)

I initially thought it was not working because it was attempting to run all the cursor movements simultaneously, but it did not appear to be that, and exiting vscode seemed like the only possible issue.

0

There are 0 answers