Задать вопрос
@NitroDesktop

Как исправить selenium — webdriver, не запускается и пишет ошибки во всех кроме хрома и мозилы, как то можно исправить?

Хром и мозила работает, а остальное нет!
from selenium import webdriver

from webdriver_manager.firefox import GeckoDriverManager
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.microsoft import IEDriverManager
from webdriver_manager.microsoft import EdgeChromiumDriverManager
from webdriver_manager.opera import OperaDriverManager

def screen_inserting(brw,sized,url):
    sized=sized.split(",")
    if brw=="chrome":
        driver = webdriver.Chrome(ChromeDriverManager().install())
        driver.set_window_size(sized[0],sized[1])
        driver.get(url)
        driver.save_screenshot("screen.png")
        # element = driver.find_element_by_tag_name('body')
        # element.screenshot("screen_new.png")
        driver.quit()
    elif brw=="firefox": 
        driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
        driver.set_window_size(sized[0],sized[1])
        driver.get(url)
        driver.save_screenshot("screen.png")
        driver.quit()
    elif brw=="iexplore":    
        driver = webdriver.Ie(IEDriverManager().install())
        driver.set_window_size(sized[0],sized[1])
        driver.get(url)
        driver.save_screenshot("screen.png")
        driver.quit()
    elif brw=="opera":
        driver = webdriver.Opera(executable_path=OperaDriverManager().install())
        driver.set_window_size(sized[0],sized[1])
        driver.get(url)
        driver.save_screenshot("screen.png")
        driver.quit()
    elif brw=="edge":
        driver = webdriver.Edge(EdgeChromiumDriverManager().install())
        driver.set_window_size(sized[0],sized[1])
        driver.get(url)
        driver.save_screenshot("screen.png")
        driver.quit()


Ошибки такого плана:
Traceback (most recent call last):
  File "d:\python\screens.py", line 121, in <module>
    screen_inserting(brw,brw_size,urls)
  File "d:\python\screens.py", line 96, in screen_inserting
    driver = webdriver.Ie(IEDriverManager().install())
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\webdriver_manager\microsoft.py", line 25, in install
    return self.download_driver(self.driver)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\webdriver_manager\manager.py", line 44, in download_driver
    path = self.__download_and_save_driver_to_cache(driver, driver_version)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\webdriver_manager\manager.py", line 32, in __download_and_save_driver_to_cache
    response = download_driver(driver.get_url(driver_version))
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\webdriver_manager\utils.py", line 58, in download_driver
    log(f"Trying to download new driver from {url}")
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\webdriver_manager\logger.py", line 12, in log
    level = int(log_level)
ValueError: invalid literal for int() with base 10: 'None'
  • Вопрос задан
  • 545 просмотров
Подписаться 2 Простой 18 комментариев
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы