InstaPy / instagram-profilecrawl

📝 quickly crawl the information (e.g. followers, tags etc...) of an instagram profile.
MIT License
1.16k stars 245 forks source link

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

Open Iamirup opened 8 months ago

Iamirup commented 8 months ago

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'
julian-elsugar commented 5 months ago

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