Skip to content

Fallback on Gecko Driver if Chrome Driver is not available. #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions openvpn/makeIt.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ def show_help():
# print(" --version Print program version and exit")
print(" -U, --update Update this program to latest version. Make sure that you have sufficient permissions (run with sudo if needed)")


def login(un=None, arg=None):
print("This might take time, just sit back and relax....")
def create_chrome_driver():
options = webdriver.ChromeOptions()

prefs = {'profile.managed_default_content_settings.images':2}
Expand All @@ -33,11 +31,26 @@ def login(un=None, arg=None):
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('log-level=3')
return webdriver.Chrome(chrome_options=options)

def create_gecko_driver():
options = webdriver.firefox.options.Options()
firefox_profile = webdriver.FirefoxProfile()
firefox_profile.set_preference('permissions.default.image', 2)
options.set_headless(headless=True)
return webdriver.Firefox(firefox_options=options, firefox_profile=firefox_profile)

def login(un=None, arg=None):
print("This might take time, just sit back and relax....")
try:
driver = create_chrome_driver()
except:
driver = create_gecko_driver()


if un == None:
un = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(5))

driver = webdriver.Chrome(chrome_options=options)
# driver = webdriver.PhantomJS('C:\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe')
driver.get('https://www.tcpvpn.com/home')

Expand Down