InstaPy / instagram-profilecrawl

📝 quickly crawl the information (e.g. followers, tags etc...) of an instagram profile.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chromedriver error

aylee17 opened this issue · comments

I'm getting a Chromedriver error even though I correctly downloaded and put it into the assets folder.

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/chromedriver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "crawl_profile.py", line 16, in <module>
    with SetupBrowserEnvironment() as browser:
  File "/Users/aylsj/Documents/Projects/instagram-profilecrawl/util/chromedriver.py", line 33, in __enter__
    self.browser = init_chromedriver(self.chrome_options, self.capabilities)
  File "/Users/aylsj/Documents/Projects/instagram-profilecrawl/util/chromedriver.py", line 48, in init_chromedriver
    browser = webdriver.Chrome(chromedriver_location,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
commented

the documentation isn't up to date, change line 14 in crawl_profile.py to

Settings.chromedriver_location = 'assets/chromedriver'

or install chromedriver in /usr/bin/chromedriver

Thanks! I'm still getting an error, although it appears to be a different one now.

Traceback (most recent call last):
  File "crawl_profile.py", line 21, in <module>
    information, user_commented_list = extract_information(browser, username, Settings.limit_amount)
  File "/Users/aylsj/Documents/Projects/instagram-profilecrawl/util/extractor.py", line 441, in extract_information
    ig_user.get_user_info()
  File "/Users/aylsj/Documents/Projects/instagram-profilecrawl/util/extractor.py", line 78, in get_user_info
    self.bio = self._user_bio()
  File "/Users/aylsj/Documents/Projects/instagram-profilecrawl/util/extractor.py", line 53, in _user_bio
    bio = self.container.find_element_by_class_name('-vDIg').find_element_by_tag_name('span').text
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py", line 305, in find_element_by_tag_name
    return self.find_element(by=By.TAG_NAME, value=name)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py", line 658, in find_element
    return self._execute(Command.FIND_CHILD_ELEMENT,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"span"}
  (Session info: headless chrome=79.0.3945.88)
commented

It doesn't seem to find any profile info, make sure the profile exists and isn't private or anything (an easy way to test it is to open it in Chrome)

I realized I'm getting this error message for the profiles that I tried before fixing the chromedriver error. But any new profiles I try after fixing chromedriver error, it works. Is it saving the history somewhere that is preventing me from running those profiles?