Repository navigation
Expand file tree
/
Copy pathWebBrowser.py
More file actions
60 lines (50 loc) · 2.1 KB
/
Copy pathWebBrowser.py
File metadata and controls
60 lines (50 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import webbrowser
import platform
def getBrowserPath(browserName) :
if browserName == 'chrome' and platform.system() == 'Windows':
return 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
elif browserName == 'chrome' and platform.system() == 'Linux':
return '/usr/bin/google-chrome %s'
elif browserName == 'chrome' and platform.system() == 'Darwin' or platform.system() == 'Java':
return 'open -a /Applications/Google\ Chrome.app %s'
elif browserName == 'opera' and platform.system() == 'Windows':
return 'C:/Users/'+ os.getlogin() +'/AppData/Local/Programs/Opera/launcher.exe'
elif browserName == 'iexplore' and platform.system() == 'Windows':
return 'C:/Program Files/internet explorer/iexplore.exe %s'
elif browserName == 'firefox' and platform.system() == 'Windows':
return 'C:/Program Files/Mozilla Firefox/firefox.exe'
else:
return ''
def openUrlInChrome(url, anonymous=False) :
# webbrowser.open_new(url)
if anonymous :
try :
webbrowser.get(f'{getBrowserPath("chrome")}{" --incognito"}').open_new_tab(url)
except :
webbrowser.get(getBrowserPath('chrome')).open_new_tab(url)
return webbrowser.get(getBrowserPath('chrome')).open_new_tab(url)
def openUrl(url) :
webbrowser.open_new(url)
# import time
# import subprocess
# import os
# import sys
# privateServerLink = 'https://www.roblox.com/games/2414851778/TIER-20-Dungeon-Quest?privateServerLinkCode=GXVlmYh0Z7gwLPBf7H5FWk3ClTVesorY'
# browserName = input(str("Browser Type: chrome, opera, iexplore, firefox : "))
# userSleepTime = int(input("How long do you want it to run?"))
# if browserName == 'opera':
# userBrowserD = 'launcher.exe'
# else:
# userBrowserD = browserName
#
# if browserName == "chrome":
# taskToKill = "chrome.exe"
# else:
# taskToKill = "iexplore.exe"
# while 1 == 1:
# subprocess.Popen('SynapseX.exe')
# time.sleep(7)
# webbrowser.get(browserPath).open_new_tab(privateServerLink)
# time.sleep(7)
# os.system('taskkill /f /im '+taskToKill)
# time.sleep(userSleepTime)