util.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:SalesforceXyTools 作者: exiahuang 项目源码 文件源码
def open_in_default_browser(url):
    browser_map = setting.get_default_browser()
    browser_name = browser_map['name']
    browser_path = browser_map['path']

    if not browser_path or not os.path.exists(browser_path) or browser_name == "default":
        webbrowser.open_new_tab(url)

    elif browser_map['name'] == "chrome-private":
        # chromex = "\"%s\" --incognito %s" % (browser_path, url)
        # os.system(chromex)
        browser = webbrowser.get('"' + browser_path +'" --incognito %s')
        browser.open(url)

        # os.system("\"%s\" -ArgumentList @('-incognito', %s)" % (browser_path, url))

    else:
        try:
            webbrowser.register('chromex', None, webbrowser.BackgroundBrowser(browser_path))
            webbrowser.get('chromex').open_new_tab(url)
        except Exception as e:
            webbrowser.open_new_tab(url)

##########################################################################################
#END
##########################################################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号