Simple functions to open Microsoft Edge incognito window dynamically from python.


def openEdgeIncognitoWithURL(url):  
    import subprocess
    from pyautogui import hotkey, press
    from time import sleep

    edge_path = 'C:\\Program Files (x86)\Microsoft\\Edge\\Application\\msedge.exe'

    subprocess.Popen([edge_path])
    sleep(3)
    hotkey('ctrl', 'shift', 'n')
    sleep(3)
    hotkey('ctrl', 'l')
    sleep(2)
    paste(url)
    sleep(1)
    pressEnter()
    sleep(10)

    return True 

def openEdgeIncognito():  

    import subprocess
    from pyautogui import hotkey, press
    from time import sleep

    edge_path = 'C:\\Program Files (x86)\Microsoft\\Edge\\Application\\msedge.exe'

    subprocess.Popen([edge_path])
    sleep(3)
    hotkey('ctrl', 'shift', 'n')
    sleep(2)
    return True



Comments

Popular posts from this blog

Apple iPad Air (2022) Specifications and Review in 2023

17-year-old suspect in fatal stabbing at Taylor Swift-themed dance event ID’d

Exercise vs Diet