I would like to run a python automation that will kill a particular chrome tab, by its url name.
For example:
if time is 09:00, and url is "www.youtube.com", kill this process.
I didn't manage to do it using psutil
, with the following code, since I could only fetch process name (chrome.exe), and not each particular url name.
for proc in psutil.process_iter():
try:
# Get process name & pid from process object.
processName = proc.name()
processID = proc.pid
print(processName, ' ::: ', processID)
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass
But the output would be as the following:
also, I tried some other python packages, such as webbrowser
and os
, but didn;t find one of them helpful.
I would like to add that while opening the task manager, it is possible to see all of the open tabs and their urls.
So, I would like to ask - do you know what's the easiet way to close a chrome tab by its url?
Thanks!