• Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    Python 3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license()" for more information.
    
    = RESTART: D:\Python_vscode\selenium\main.py
    Traceback (most recent call last):
      File "C:\Users\other\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 58, in _binary_paths
        path = self._service.path
    AttributeError: 'str' object has no attribute 'path'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "D:\Python_vscode\selenium\main.py", line 33, in <module>
        print(get_source("KirillSafe"))
      File "D:\Python_vscode\selenium\main.py", line 24, in get_source
        driver = webdriver.Chrome(options=options, service=service)
      File "C:\Users\other\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__
        super().__init__(
      File "C:\Users\other\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 50, in __init__
        if finder.get_browser_path():
      File "C:\Users\other\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 47, in get_browser_path
        return self._binary_paths()["browser_path"]
      File "C:\Users\other\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 78, in _binary_paths
        raise NoSuchDriverException(msg) from err
    selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    rPman, насчет первого да, запускается. а насчет русского названия - я развеял сомнения,создал английский профиль,скачал туда python и запустил с него,все та же ошибка

    Python 3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license()" for more information.
    
    Warning (from warnings module):
      File "D:\Python_vscode\selenium\main.py", line 7
        options.binary_location = "D:\Python_vscode\selenium\chrome-win64\chrome.exe"
    SyntaxWarning: invalid escape sequence '\P'
    >>> 
    Warning (from warnings module):
      File "D:\Python_vscode\selenium\main.py", line 22
        service = "D:\Python_vscode\selenium\chrome-win64\chrome.exe"
    SyntaxWarning: invalid escape sequence '\P'
    >>> 
    = RESTART: D:\Python_vscode\selenium\main.py
    Traceback (most recent call last):
      File "C:\Users\other\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 58, in _binary_paths
        path = self._service.path
    AttributeError: 'str' object has no attribute 'path'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "D:\Python_vscode\selenium\main.py", line 33, in <module>
        print(get_source("KirillSafe"))
      File "D:\Python_vscode\selenium\main.py", line 24, in get_source
        driver = webdriver.Chrome(options=options, service=service)
      File "C:\Users\other\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__
        super().__init__(
      File "C:\Users\other\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 50, in __init__
        if finder.get_browser_path():
      File "C:\Users\other\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 47, in get_browser_path
        return self._binary_paths()["browser_path"]
      File "C:\Users\other\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 78, in _binary_paths
        raise NoSuchDriverException(msg) from err
    selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    rPman, Да пути переставил и в сервисе и в сет бинари(
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    rPman, не помогло. люблю селениум
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    Kirill_Safe, Попробовал так-же такой способ
    options.binary_location = "D:\Python_vscode\selenium\chrome-win64\chrome.exe"


    выдает все ту же ошибку driver_location
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    rPman, мой
    код
    import json
    import time
    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    
    options = Options()
    options.setBinary("D:\Python_vscode\selenium\chrome-win64\chrome.exe")
    options.add_argument("--disable-images")
    options.add_argument("--disable-webgl")
    options.add_argument("--enable-javascript")
    options.add_argument("--enable-chrome-browser-cloud-management")
    
    
    # Импорт куки из файла cookies.json
    with open('cookies.json', 'r') as f:
        cookies = json.load(f)
    
    # Добавление куки в браузер
    
    
    # Дополнительное ожидание после добавления куки
    service = "./chrome-win64/chrome.exe"
    def get_source(url):
        driver = webdriver.Chrome(options=options, service=service)
        driver.get('https://excalibur-craft.ru/index.php?do=profile&name=' + url)
        for cookie in cookies:
            driver.add_cookie(cookie)
        driver.refresh()
        time.sleep(10)
        source_code = driver.page_source
        return source_code
    
    print(get_source("KirillSafe"))
    теперь выдает
    такую ошибку
    PS D:\Python_vscode\selenium> & C:/Users/Кирилл/AppData/Local/Microsoft/WindowsApps/python3.12.exe d:/Python_vscode/selenium/main.py
    d:\Python_vscode\selenium\main.py:7: SyntaxWarning: invalid escape sequence '\P'
      options.setBinary("D:\Python_vscode\selenium\chrome-win64\chrome.exe")
    Traceback (most recent call last):
      File "d:\Python_vscode\selenium\main.py", line 7, in <module>
        options.setBinary("D:\Python_vscode\selenium\chrome-win64\chrome.exe")
        ^^^^^^^^^^^^^^^^^
    AttributeError: 'Options' object has no attribute 'setBinary'
    PS D:\Python_vscode\selenium>
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    Ну вроде бы установил тот веб драйвер,какой и браузер но не понимаю,что ему теперь не нравится :D

    service = "./chrome-win64/chrome.exe"
    
    
    
    PS D:\Python_vscode\selenium> & C:/Users/Кирилл/AppData/Local/Microsoft/WindowsApps/python3.12.exe d:/Python_vscode/selenium/main.py
    Traceback (most recent call last):
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\common\driver_finder.py", line 58, in _binary_paths
        path = self._service.path
               ^^^^^^^^^^^^^^^^^^
    AttributeError: 'str' object has no attribute 'path'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "d:\Python_vscode\selenium\main.py", line 33, in <module>
        print(get_source("KirillSafe"))
              ^^^^^^^^^^^^^^^^^^^^^^^^
      File "d:\Python_vscode\selenium\main.py", line 24, in get_source
        driver = webdriver.Chrome(options=options, service=service)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__
        super().__init__(
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\chromium\webdriver.py", line 50, in __init__
        if finder.get_browser_path():
           ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\common\driver_finder.py", line 47, in get_browser_path
        return self._binary_paths()["browser_path"]
               ^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\common\driver_finder.py", line 78, in _binary_paths
        raise NoSuchDriverException(msg) from err
    selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location


    663bc12f0d1aa007764094.png
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    rPman, А ой, щас попробую установить новый веб драйвер,я думал этот новый,а там еще раздел есть

    У вас установлена последняя версия Chrome
    Версия 124.0.6367.156 (Официальная сборка), (64 бит)
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    rPman, Да я скачал chromium, а он там готовый уже(без установщика,сразу запускается
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    rPman, Либо я что-то не так делаю,либо я незнаю

    PS D:\Python_vscode\selenium> chromedriver.exe --version
    chromedriver.exe : Имя "chromedriver.exe" не распознано как имя командлета, функции, файла сценария или выполняемой программы. Проверьте правильность написания имени, а т
    акже наличие и правильность пути, после чего повторите попытку.
    строка:1 знак:1
    + chromedriver.exe --version
    + ~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (chromedriver.exe:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    
    
    Suggestion [3,General]: Команда chromedriver.exe не найдена, однако существует в текущем расположении. По умолчанию оболочка Windows PowerShell не загружает команды из текущего расположения. Если вы уверены в надежности команды, введите ".\chromedriver.exe". Для получения дополнительных сведений вызовите справку с помощью команды "get-help about_Command_Precedence".
    PS D:\Python_vscode\selenium> .\chromedriver.exe
    Starting ChromeDriver 114.0.5735.90 (386bc09e8f4f2e025eddae123f36f6263096ae49-refs/branch-heads/5735@{#1052}) on port 9515
    Only local connections are allowed.
    Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
    ChromeDriver was started successfully.
    PS D:\Python_vscode\selenium>
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    rPman, В итоге установил chrome browser ведь я не очень понял как chromium установить.
    Ошибка осталась
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    rPman, Нет, сейчас попробую установить chromium.
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    Раньше и стоял такой способ ./chromedriver.exe

    Попробовал полный путь:
    d:\Python_vscode\selenium\main.py:22: SyntaxWarning: invalid escape sequence '\P'
      service = "D:\Python_vscode\selenium\chromedriver.exe"
    Traceback (most recent call last):
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\common\driver_finder.py", line 58, in _binary_paths
        path = self._service.path
               ^^^^^^^^^^^^^^^^^^
    AttributeError: 'str' object has no attribute 'path'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "d:\Python_vscode\selenium\main.py", line 33, in <module>
        print(get_source("KirillSafe"))
              ^^^^^^^^^^^^^^^^^^^^^^^^
      File "d:\Python_vscode\selenium\main.py", line 24, in get_source
        driver = webdriver.Chrome(options=options, service=service)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__
        super().__init__(
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\chromium\webdriver.py", line 50, in __init__
        if finder.get_browser_path():
           ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\common\driver_finder.py", line 47, in get_browser_path
        return self._binary_paths()["browser_path"]
               ^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\common\driver_finder.py", line 78, in _binary_paths
        raise NoSuchDriverException(msg) from err
    selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    Теперь такая ошибка :D

    PS D:\Python vscode\selenium> & C:/Users/Кирилл/AppData/Local/Microsoft/WindowsApps/python3.12.exe "d:/Python vscode/selenium/main.py"
    Traceback (most recent call last):
      File "d:\Python vscode\selenium\main.py", line 34, in <module>
        print(get_source("KirillSafe"))
              ^^^^^^^^^^^^^^^^^^^^^^^^
      File "d:\Python vscode\selenium\main.py", line 25, in get_source
        driver = webdriver.Chrome(options=options, service=service, executable_path=executable_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: WebDriver.__init__() got an unexpected keyword argument 'executable_path'
    Написано
  • Selenium не видит мой webdriver,что делать?

    @Kirill_Safe Автор вопроса
    Здравствуйте,переместил на диск D, вот лог:

    Лог
    PS D:\Python vscode\selenium> & C:/Users/Кирилл/AppData/Local/Microsoft/WindowsApps/python3.12.exe "d:/Python vscode/selenium/main.py"
    Traceback (most recent call last):
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\common\driver_finder.py", line 58, in _binary_paths
        path = self._service.path
               ^^^^^^^^^^^^^^^^^^
    AttributeError: 'str' object has no attribute 'path'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "d:\Python vscode\selenium\main.py", line 34, in <module>
        print(get_source("KirillSafe"))
              ^^^^^^^^^^^^^^^^^^^^^^^^
      File "d:\Python vscode\selenium\main.py", line 25, in get_source
        driver = webdriver.Chrome(options=options, service=service)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__
        super().__init__(
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\chromium\webdriver.py", line 50, in __init__
        if finder.get_browser_path():
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\common\driver_finder.py", line 47, in get_browser_path
        return self._binary_paths()["browser_path"]
               ^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Кирилл\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\selenium\webdriver\common\driver_finder.py", line 78, in _binary_paths
        raise NoSuchDriverException(msg) from err
    selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
    
    PS D:\Python vscode\selenium> ls
    
    
        Каталог: D:\Python vscode\selenium
    
    
    Mode                 LastWriteTime         Length Name
    ----                 -------------         ------ ----
    d-----        08.05.2024     20:50                .vscode
    -a----        26.05.2023     23:39       12273664 chromedriver.exe
    -a----        08.05.2024     17:27           3035 cookies.json
    -a----        26.05.2023     23:39         248545 LICENSE.chromedriver
    -a----        08.05.2024     21:25           1043 main.py
    -a----        24.01.2024     17:37       14335488 yandexdriver.exe
    -a----        08.05.2024     21:24            110 Новый текстовый документ.txt
    Написано
  • Как сделать автовыдачу "очков" в переменные?

    @Kirill_Safe Автор вопроса
    Vindicar, извиняюсь, да
    Написано
  • Как исправить "ReferenceError: message is not defined"?

    @Kirill_Safe Автор вопроса
    А как аргумент этот убрать? я просто только начинающий кодер незнаю что к чему