🖥️ IT, 컴퓨터/🐍 Python

[Python] 파이썬 오류 :: 'str' object has no attribute 'capabilities'

김 홍시 2023. 12. 16.
반응형

문제상황

 

셀레늄을 이용해 크롤링을 하던 중, 이와 같은 오류가 발생하였다.

 

 

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/common/driver_finder.py in get_path(service, options)
     37         try:
---> 38             path = SeleniumManager().driver_location(options) if path is None else path
     39         except Exception as err:

4 frames
AttributeError: 'str' object has no attribute 'capabilities'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/common/driver_finder.py in get_path(service, options)
     38             path = SeleniumManager().driver_location(options) if path is None else path
     39         except Exception as err:
---> 40             msg = f"Unable to obtain driver for {options.capabilities['browserName']} using Selenium Manager."
     41             raise NoSuchDriverException(msg) from err
     42 

AttributeError: 'str' object has no attribute 'capabilities'

 

해결방법

현재 코드가

 

 

driver = webdriver.Chrome('./chromedriver')  # 드라이버 경로

 

이와 같이 되어있다.

끝 부분  './chromedriver'을 지우자.

driver = webdriver.Chrome()  # 드라이버 경로

지워주니 잘 돌아간다.

반응형

댓글