Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Iamirup opened this issue Feb 18, 2024 · 1 comment
Open

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

Iamirup opened this issue Feb 18, 2024 · 1 comment

Comments

@Iamirup
Copy link

Iamirup commented Feb 18, 2024

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants