示例#1
0
def _new_webbrowser_profile():
    if is_command("google-chrome"):
        return _make_chrome("google-chrome")
    elif is_command("firefox"):
        new_firefox = webbrowser.Mozilla()
        new_firefox.name = "firefox"
        profile_directory = tempfile.mkdtemp()
        new_firefox.remote_args = [
            "-profile",
            profile_directory,
            "-new-instance",
            "-no-remote",
            "-url",
            "%s",
        ]
        return new_firefox
    elif sys.platform == "darwin":
        config = get_config()
        chrome_path = config.get("chrome-path")
        if os.path.exists(chrome_path):
            return _make_chrome(chrome_path)
        else:
            return webbrowser
    else:
        return webbrowser
示例#2
0
def create_browser(browser, path):
    if browser == 'chrome':
        return webbrowser.Chrome(path)
    if browser == 'firefox':
        return webbrowser.Mozilla(path)

    return False
示例#3
0
def use_firefox_open_url(url):
    browser_path = r'D:\Program Files (x86)\Mozilla Firefox\firefox.exe'
    #这里的‘firefox’只是一个浏览器的代号,可以命名为自己认识的名字,只要浏览器路径正确
    web.register('firefox', web.Mozilla('mozilla'),
                 web.BackgroundBrowser(browser_path))
    #web.get('firefox').open(url,new=1,autoraise=True)
    web.get('firefox').open_new_tab(url)
    print('use_firefox_open_url  open url ending ....')
示例#4
0
def new_webbrowser_profile():
    if webbrowser._iscommand('google-chrome'):
        new_chrome = webbrowser.Chrome()
        new_chrome.name = 'google-chrome'
        profile_directory = tempfile.mkdtemp()
        new_chrome.remote_args = webbrowser.Chrome.remote_args + [
            '--user-data-dir="{}"'.format(profile_directory)
        ]
        return new_chrome
    elif webbrowser._iscommand('firefox'):
        new_firefox = webbrowser.Mozilla()
        new_firefox.name = 'firefox'
        profile_directory = tempfile.mkdtemp()
        new_firefox.remote_args = [
            '-profile',
            profile_directory,
            '-new-instance',
            '-no-remote',
            '-url',
            '%s',
        ]
        return new_firefox
    else:
        return webbrowser
示例#5
0
 def install_trap_browser():
     import webbrowser
     webbrowser.register(name="echo",
                         klass=None,
                         instance=webbrowser.Mozilla("echo"),
                         preferred=True)
示例#6
0
import pyautogui
import psutil
import pyjokes
import numpy as np

driver = webdriver.Chrome(
    executable_path="your path")

SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']
MONTHS = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november",
          "december"]
DAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
DAY_EXT = ["rd", "th", "st", "nd"]
WAKE = "jarvis"
num = 1
webbrowser.Mozilla()
date = datetime.datetime.today().date().strftime('%d/%m/%Y')
googlenews = GoogleNews(lang='en', period='d', start=date, end=date)
root = tk.Tk()
peo = {
    your contacts
}
pyautogui.hotkey('winleft', 'down')


def speak(output):
    global num
    num += 1
    print("JARVIS: ", output)
    toSpeak = gTTS(text=output, lang='en-US', slow=False)
    file = str(num) + ".mp3"
示例#7
0
文件: ONUW_Bot.py 项目: SirEctor/ONUW
import webbrowser, bs4, requests
from selenium import webdriver
if __name__ == "__main__":
    print("")
    #credit - https://stackoverflow.com/questions/832331/launch-a-webpage-on-a-firefox-win-tab-using-python
    firefox = webbrowser.Mozilla("C:\\Program Files\\Mozilla Firefox\\firefox.exe")

    print("\nReady to Join!")
    joinCode = input("Enter join code:\n")
    firefox.open_new_tab("https://werewolf.invades.space/")

示例#8
0
def launch_firefox():
    firefox_path = "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"
    webbrowser.register('firefox', None, webbrowser.Mozilla(firefox_path))
    speak('opening firefox browser ...')
    webbrowser.get('firefox')