I am writing an application where I am checking for a condition to be true every second. If the condition is true, a specific url needs to get opened in Chrome but only if that URL isn't already opened in chrome. Otherwise if the condition is true, every second a new tab will be opened. How do I check that? I know below code is used to check if chrome is running but how do I check which URL is running in Chrome?
import psutil as psutil
for proc in psutil.process_iter():
proc_name = proc.name()
if proc_name == 'chrome.exe':
print('chrome is running now.')
# open your program in this position
else:
print(proc_name)
My current code is below:
def workflow_chilled_water_trigger():
threading.Timer(1.0, workflow_chilled_water_trigger).start()
flow=float(flow_main_chiller())
supply_temp=float(inlet_temp_main_chiller())
return_temp=float(outlet_temp_main_chiller())
if ((flow > 0) or ((return_temp-supply_temp)<5)):
os.system('start chrome "https://www.youtube.com"')
workflow_chilled_water_trigger()