instagram-profilecrawl icon indicating copy to clipboard operation
instagram-profilecrawl copied to clipboard

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

Open Iamirup opened this issue 2 years ago • 1 comments

after running "python3 crawl_profile.py ":

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/common/driver_finder.py", line 38, in get_path
    path = SeleniumManager().driver_location(options) if path is None else path
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/common/selenium_manager.py", line 87, 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 "/root/instagram-profilecrawl/crawl_profile.py", line 14, in <module>
    with SetupBrowserEnvironment() as browser:
  File "/root/instagram-profilecrawl/util/chromedriver.py", line 35, in __enter__
    self.browser = init_chromedriver(self.chrome_options, self.capabilities)
  File "/root/instagram-profilecrawl/util/chromedriver.py", line 53, in init_chromedriver
    browser = webdriver.Chrome(ChromeDriverManager().install())
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chromium/webdriver.py", line 49, in __init__
    self.service.path = DriverFinder.get_path(self.service, options)
  File "/usr/local/lib/python3.10/dist-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'

Iamirup avatar Feb 18 '24 14:02 Iamirup

May be you are using wsl

Is this is the case try running chromium

/usr/bin/chromium-browser

If you get:

Command '/usr/bin/chromium-browser' requires the chromium snap to be installed. Please install it with:

snap install chromium

Go to power shell

do:

wsl --shutdown wsl --update

Then log bacl to wsl and:

snap install chromium

julian-elsugar avatar May 21 '24 03:05 julian-elsugar