Этот код выдает исключение:
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get('https://www.google.com')
time.sleep(10)
Вот обратная трассировка:
Traceback (most recent call last):
File "/home/orangepi/.local/lib/python3.10/site-packages/selenium/webdriver/common/selenium_manager.py", line 134, in run
completed_proc = subprocess.run(args, capture_output=True)
File "/usr/lib/python3.10/subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/orangepi/.local/lib/python3.10/site-packages/selenium/webdriver/common/linux/selenium-manager'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/orangepi/.local/lib/python3.10/site-packages/selenium/webdriver/common/driver_finder.py", line 38, in get_path
path = SeleniumManager().driver_location(options) if path is None else path
File "/home/orangepi/.local/lib/python3.10/site-packages/selenium/webdriver/common/selenium_manager.py", line 103, in driver_location
output = self.run(args)
File "/home/orangepi/.local/lib/python3.10/site-packages/selenium/webdriver/common/selenium_manager.py", line 140, in run
raise WebDriverException(f"Unsuccessful command executed: {command}") from err
selenium.common.exceptions.WebDriverException: Message: Unsuccessful command executed: /home/orangepi/.local/lib/python3.10/site-packages/selenium/webdriver/common/linux/selenium-manager --browser chrome --output json
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/orangepi/Downloads/from selenium import webdriver.py", line 3, in <module>
driver = webdriver.Chrome()
File "/home/orangepi/.local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
super().__init__(
File "/home/orangepi/.local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 49, in __init__
self.service.path = DriverFinder.get_path(self.service, options)
File "/home/orangepi/.local/lib/python3.10/site-packages/selenium/webdriver/common/driver_finder.py", line 41, in get_path
raise NoSuchDriverException(msg) from err
selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome using Selenium Manager.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
Я не знаю, где я ошибаюсь: установлен Chrome; Я попробовал несколько уроков, но безуспешно.
Кстати, просто чтобы посмотреть на первоначальную ошибку, найдите «OSError: [Errno 8] Exec format error».






Selenium ищет драйвер Chrome в переменных вашего пути, вы можете добавить его вручную или установить драйвер в своем коде.
Эту проблему обычно можно легко решить, загрузив драйвер Chrome https://developer.chrome.com/docs/chromedriver/downloads?hl=fr
Затем вы можете указать путь к этому драйверу в коде или в вашей переменной окружения.
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe')
Окончательный код:
from selenium import webdriver
# Optional argument : if not specified WebDriver will search your system PATH environment variable for locating the chromedriver
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
это не ответ для меня, но я бы подал заявку любому, кто не использует Arm64, все равно нашел мой
Ошибка произошла из-за того, что я использовал webdriver.Chrome(), который ищет веб-драйвер для Chrome. ОС, которую я использую, работает на ARM64 и может использовать только Chromium. Источник.
Чтобы использовать Chromium, вам необходимо использовать менеджер веб-драйверов.
Вы посетили данную ссылку?