I am not taking about headless browser.
I am writing an script, when a directory get a new file, it will open an url, when the file deleted from directory, it will open another url.
My Script is below:
import os, time
def folderListener(mydir):
old_list = len(os.listdir(mydir))
new_list = 0
while True:
new_list = len(os.listdir(mydir))
if old_list != new_list:
old_list = new_list
print('OPen first url in chrom browser')
else:
print('Open 2nd URL in Chrome Browser')
time.sleep(2)
if __name__ == '__main__':
mydir = os.getcwd() + '/testdir'
folderListener(mydir)
The script working very nice, now i need to it in the script when print function place. i mean, it should open an URL on Chrome Browser instead, no headless chrome browser.
os.startfile(url)(probably only Windows),os.system("chrome url"),webbrowser.open(url),selenium.webdriver.Chrome().get(url)