Ejemplo n.º 1
0
def get_geckodriver():
    gecko_path = shutil.which("geckodriver") or shutil.which("geckodriver.exe")
    if gecko_path:
        return gecko_path
    gdd = GeckoDriverDownloader(ASSETS_PATH, ASSETS_PATH)
    _, sym_path = gdd.download_and_install()
    return sym_path
Ejemplo n.º 2
0
def get_geckodriver():
    # prefer using geckodriver from path
    gecko_path = shutil.which("geckodriver") or shutil.which("geckodriver.exe")
    if gecko_path:
        return gecko_path

    asset_path = use_assets()
    gdd = GeckoDriverDownloader(asset_path, asset_path)
    # skips download if already downloaded
    sym_path = gdd.download_and_install()[1]
    return sym_path
Ejemplo n.º 3
0
def get_geckodriver():
    print('getting geckodriver')
    # prefer using geckodriver from path
    gecko_path = shutil.which("geckodriver") or shutil.which("geckodriver.exe")
    if gecko_path:
        return gecko_path
    print('gecko path', gecko_path)

    asset_path = use_assets()
    print('asset path', asset_path)
    gdd = GeckoDriverDownloader(asset_path, asset_path)
    print('gdd', gdd)
    # skips download if already downloaded
    bin_path, sym_path = gdd.download_and_install()
    print('bin path', bin_path)
    print('sym_path', sym_path)
    return sym_path
    def __init_browser(cls, download_folder):
        if cls.__BROWSER is None:
            webdriver_path = os.path.join(os.path.expanduser('~'), '.webdriver')
            gdd = GeckoDriverDownloader(download_root=webdriver_path, link_path=os.path.join(webdriver_path, 'bin'))
            geckodriver_path = gdd.download_and_install()[0]

            profile = webdriver.FirefoxProfile()
            profile.set_preference('browser.download.folderList', 2)
            profile.set_preference('browser.download.manager.showWhenStarting', False)
            profile.set_preference('browser.download.dir', os.path.abspath(download_folder))
            profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'application/x-gzip;application/zip')

            options = Options()
            options.headless = True

            # driver = webdriver.Firefox(firefox_binary=FirefoxBinary('F:\\FirefoxPortable\\Firefox.exe'),
            #                            firefox_profile=profile, options=options, executable_path=geckodriver_path)
            cls.__BROWSER = webdriver.Firefox(firefox_profile=profile, options=options,
                                              executable_path=geckodriver_path, service_log_path=os.devnull)
            cls.__BROWSER.set_window_size(1920, 1080)
Ejemplo n.º 5
0
 def download_and_install(self):
     gdd = GeckoDriverDownloader()
     gdd.download_and_install()
Ejemplo n.º 6
0
def webdrivers_install(*args):
    from webdriverdownloader import GeckoDriverDownloader, ChromeDriverDownloader
    gdd = GeckoDriverDownloader()
    gdd.download_and_install()
# COPY OVER FIREFOX FOLDER INTO NEW SUBFOLDER JUST CREATED
!cp -a "../input/firefox-63.0.3.tar.bz2/firefox" "../working"
!ls -l "../working/firefox"

# ADD READ/WRITE/EXECUTE CAPABILITES
!chmod -R 777 "../working/firefox"
!ls -l "../working/firefox"

# INSTALL PYTHON MODULE FOR AUTOMATIC HANDLING OF DOWNLOADING AND INSTALLING THE GeckoDriver WEB DRIVER WE NEED
!pip install webdriverdownloader

# INSTALL LATEST VERSION OF THE WEB DRIVER
from webdriverdownloader import GeckoDriverDownloader
gdd = GeckoDriverDownloader()
gdd.download_and_install("v0.23.0")

# INSTALL SELENIUM MODULE FOR AUTOMATING THINGS
!pip install selenium

# LAUNCHING FIREFOX, EVEN INVISIBLY, HAS SOME DEPENDENCIES ON SOME SCREEN-BASED LIBARIES
!apt-get install -y libgtk-3-0 libdbus-glib-1-2 xvfb

# SETUP A VIRTUAL "SCREEN" FOR FIREFOX TO USe
!export DISPLAY=:99
    
print('**************')
print('** COMPLETE **')
print('**************')

######################################################################################################
Ejemplo n.º 8
0
import sys
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from pynput.keyboard import Controller, Key
import keyboard
import time
import geckodriver_autoinstaller
from webdriverdownloader import GeckoDriverDownloader

gdd = GeckoDriverDownloader()
gdd.download_and_install()

keyboardpy = Controller()

errorList = [
    "Invalid Arguments", "connection refused, check internet connection"
]


def Exit(Error, errorMessage):
    if Error:
        print("Error! something went wrong!")
        print("Error Message: " + errorMessage)

    print("Press any key to exit!")
    input()
    sys.exit(0)


# function for loggin into an account and starting the newest lesson
Ejemplo n.º 9
0
#By the by, there is also a Python package for installing geckodriver
!pip install --no-cache webdriverdownloader
#This can be used as follows within a notebook
from webdriverdownloader import GeckoDriverDownloader
gdd = GeckoDriverDownloader()
geckodriver, geckobin = gdd.download_and_install("v0.23.0")

#If required, the path to the drive can be set explicitly:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
 
options = Options()
options.headless = True
 
driver = webdriver.Firefox(options=options)
#driverdriver = webdriver.Firefox(executable_path=geckobin, options=options)
Ejemplo n.º 10
0
def install():
    dd = GeckoDriverDownloader()
    dd.download_and_install(version="v0.23.0")
Ejemplo n.º 11
0
def download_geckodriver():
    gdd = GeckoDriverDownloader()
    gdd.download_and_install()
Ejemplo n.º 12
0
 def run(self):
     install.run(self)
     from webdriverdownloader import GeckoDriverDownloader
     gdd = GeckoDriverDownloader()
     gdd.download_and_install()
     print("geckodriver installed")