9 글 보임 - 1 에서 9 까지 (총 9 중에서)
-
글쓴이글
-
2024년 1월 17일 14:56 #110467
NB참가자셀레니움 4.16.0 버전 오류나서 3.14.1 버전도 다운받아서 돌려봤는데 실행이 되지 않습니다. 현재 크롬드라이버 120버전 쓰고 있습니다. 3.14.1 버전 사용해서
from selenium import webdriver from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome('chromedriver.exe') driver.get('https://instagram.com') 이 명령어 돌릴 시 아래와 같은 메세지 출력되고 인터넷 창이 열리지 않습니다. 인터넷 돌아다니며 해결법 찾아봤는데 도무지 해결되질 않네요. 혹시 방법있을까요?
Traceback (most recent call last): File "C:\Users\NoteA\OneDrive\바탕 화면\Practice\app.py", line 5, in <module> driver = webdriver.Chrome() ^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__ RemoteWebDriver.__init__( File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 319, in execute response = self.command_executor.execute(driver_command, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 376, in execute return self._request(command_info[0], url, body=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 399, in _request resp = self._conn.request(method, url, body=body, headers=headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\_request_methods.py", line 118, in request return self.request_encode_body( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\_request_methods.py", line 217, in request_encode_body return self.urlopen(method, url, **extra_kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\poolmanager.py", line 433, in urlopen conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\poolmanager.py", line 304, in connection_from_host return self.connection_from_context(request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\poolmanager.py", line 329, in connection_from_context return self.connection_from_pool_key(pool_key, request_context=request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\poolmanager.py", line 352, in connection_from_pool_key pool = self._new_pool(scheme, host, port, request_context=request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\poolmanager.py", line 266, in _new_pool return pool_cls(host, port, **request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 196, in __init__ timeout = Timeout.from_float(timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\timeout.py", line 190, in from_float return Timeout(read=timeout, connect=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\timeout.py", line 119, in __init__ self._connect = self._validate_timeout(connect, "connect") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\timeout.py", line 156, in _validate_timeout raise ValueError( ValueError: Timeout value connect was <object object at 0x0000021127EE8610>, but it must be an int, float or None.
2024년 1월 17일 20:07 #110501
NB참가자3.14.1 버전 언인스톨 후 4.11.2 버전 인스톨하여 실행하니 아래와 같은 문구 출력됩니다.
Traceback (most recent call last): File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\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 "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\selenium_manager.py", line 71, in driver_location browser = options.capabilities["browserName"] ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'capabilities'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\NoteA\OneDrive\바탕 화면\Practice\app.py", line 5, in <module> driver = webdriver.Chrome('chromedriver.exe') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 51, in __init__ self.service.path = DriverFinder.get_path(self.service, options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 40, in get_path msg = f"Unable to obtain driver for {options.capabilities['browserName']} using Selenium Manager." ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'capabilities'
2024년 1월 18일 09:31 #110548
codingapple키 마스터webdriver.Chrome('chromedriver.exe')를 webdriver.Chrome() 로 써봅시다
2024년 1월 18일 11:02 #110556
NB참가자코드 바꿔서 실행했습니다. 하는 김에 크롬드라이버도 권장버전 맞는지 확인하고 돌렸는데도 계속 오류가 납니다.
Traceback (most recent call last): File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\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 "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\selenium_manager.py", line 90, in driver_location output = self.run(args) ^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\selenium_manager.py", line 138, in run raise WebDriverException(f"Unsuccessful command executed: {command}.\n{result}{stderr}") selenium.common.exceptions.WebDriverException: Message: Unsuccessful command executed: C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser chrome --output json. {'code': 69, 'message': 'Driver unavailable: Driver path: ', 'driver_path': '', 'browser_path': ''}
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Users\NoteA\OneDrive\바탕 화면\Practice\app.py", line 5, in <module> driver = webdriver.Chrome() ^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 51, in __init__ self.service.path = DriverFinder.get_path(self.service, options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\NoteA\AppData\Local\Programs\Python\Python312\Lib\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
2024년 1월 18일 15:56 #110603
NB참가자이미 강의 영상대로 같은 파일에 chromedriver.exe파일이랑 app.py 파이썬 파일이랑 같이 두고 실행한 상태입니다. 혹시 python.exe파일도 같은 폴더에 넣고 코드 실행해보라는 말씀이신가요?
2024년 1월 18일 19:00 #110623
codingapple키 마스터근데 4.10버전 이상이면 크롬드라이버 다운안받아도 잘되는거같군요 onedrive 폴더 바깥에다가 만들어서 밑에 코드넣고 테스트해봅시다
from selenium import webdriver from selenium.webdriver.chrome.service import Service
service = Service() options = webdriver.ChromeOptions() driver = webdriver.Chrome(service=service, options=options)
-
글쓴이글
9 글 보임 - 1 에서 9 까지 (총 9 중에서)
- 답변은 로그인 후 가능합니다.