def test_example():
    """
    First test
    """
    #Создаем объект менеджер
    gdd = GeckoDriverManager()
    gdd.download_and_install()
    # proxy = Proxy("http://user@password:proxy.example.com:123")
    option = FirefoxOptions()
    option.set_capability("browserName", "chrome")
    wd = webdriver.Firefox(options=option)
    wd.get("https://otus.ru/")
    assert wd.title == 'Онлайн‑курсы для профессионалов, дистанционное обучение современным профессиям'
    wd.quit()
def start_browser():
    opts = Options()
    # if headless == "y":
    opts.add_argument("--headless")
    firefox_profile = webdriver.FirefoxProfile()
    firefox_profile.set_preference('permissions.default.image', 2)
    firefox_profile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so',
                                   False)
    try:
        driver = Firefox(firefox_profile=firefox_profile, options=opts)
    except WebDriverException:
        print("Geckodriver not detected, it will now be downloaded...")
        gdd = GeckoDriverManager()
        gdd.download_and_install()
        driver = Firefox(firefox_profile=firefox_profile, options=opts)
    return driver
Example #3
0
    def firefox(self):
        from webdrivermanager import GeckoDriverManager
        gdd = GeckoDriverManager()
        path = gdd.download_and_install()
        print(path)

        try:
            self.driver = webdriver.Firefox()
            return
        except:
            print('firefox - not avaliable')

        raise
Example #4
0
def browser(request):
    browser = request.config.getoption()
    if browser == 'Firefox':
        gdm = GeckoDriverManager()
        gdm.download_and_install()
        option = FirefoxOptions()
        # option.add_argument('--kiosk')
        option.headless = True
        wd = webdriver.Firefox(options=option)
        request.addfinalizer(wd.quit)
        return wd
    if browser == 'Chrome':
        cdm = ChromeDriverManager()
        cdm.download_and_install()
        option = ChromeOptions()
        # option.add_argument('--kiosk')
        # option.add_argument('--ignore-certificate-errors')
        option.headless = True
        wd = webdriver.Chrome(options=option)
        request.addfinalizer(wd.quit)
        return wd
    else:
        raise Exception(f'{request.param} is not supported!')
def install_gecko_driver():
    gdd = GeckoDriverManager()
    gdd.download_and_install()
Example #6
0
 def setUpClass(cls):
     super(SeleniumTestCase, cls).setUpClass()
     gdd = GeckoDriverManager()
     gdd.download_and_install()
Example #7
0
 def setUpClass(cls):
     super(SeleniumTestCase, cls).setUpClass()
     gdd = GeckoDriverManager()
     gdd.download_and_install()
Example #8
0
def SetupWebdriver():
    from webdrivermanager import GeckoDriverManager
    gdd = GeckoDriverManager()
    gdd.download_and_install()
Example #9
0
status_names = []

with open(os.path.join(os.getcwd(), city_path)) as f:
    city_names = json.load(f)
with open(os.path.join(os.getcwd(), airlines_path)) as f:
    airline_names = json.load(f)
with open(os.path.join(os.getcwd(), status_path)) as f:
    status_names = json.load(f)

city_trie = Trie(city_names)
airline_trie = Trie(airline_names)
status_trie = Trie(status_names)

# req = Request('https://www.bud.hu/en/arrivals', headers=headers)

driver = webdriver.Firefox(executable_path=gdd.download_and_install()[0],
                           options=options)
#https://www.bud.hu/en/arrivals
#https://www.heathrow.com/arrivals
#https://www.amman-airport.com/queen-alia-arrivals?tp=6
#https://www.sharjahairport.ae/en/traveller/flight-information/passenger-arrivals/
website_url = 'https://www.bud.hu/en/arrivals'
driver.get(website_url)
html = driver.find_element_by_tag_name('html')

#creating a scroll like event for websites which load data on scroll
count = 50
while (count > 0):
    html.send_keys(Keys.DOWN)
    count = count - 1
soup = BeautifulSoup(driver.page_source, 'html.parser')