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

(unknown error: DevToolsActivePort file doesn't exist) #18

Closed
11111022222 opened this issue Mar 30, 2020 · 5 comments
Closed

(unknown error: DevToolsActivePort file doesn't exist) #18

11111022222 opened this issue Mar 30, 2020 · 5 comments

Comments

@11111022222
Copy link

11111022222 commented Mar 30, 2020

I managed to fix it with --headless argument on ChromeOptions but i believe it's causing the authentication process to fail at https://m.facebook.com/.

Any other way to fix it?

root@vps717621:~/graph_me_fb/facebook-scraper# python make.py --index
Opening Browser...
Traceback (most recent call last):
  File "make.py", line 388, in <module>
    browser = start_browser()
  File "make.py", line 53, in start_browser
    browser = Chrome(options=options)
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
@jcontini
Copy link
Owner

Hi @vtroussel, I haven't come across this issue but there are some threads where others have solved this issue:

My suggestion would be:

  • Install the latest version of Chrome Beta - not the normal Chrome. This is because chromedriver-binary has to match the latest version of the beta
  • Run pipenv install to make sure the latest chromedriver-binary is installed

If that doesn't work, you could try these lines (instead of --headless):

options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')

And finally if that doesn't work, you could try updating browser to Chrome('/path/to/your_chrome_driver_dir/chromedriver',options=chrome_options)

Let me know if any of these work for you, so we can find a way to prevent it from happening for others.

@11111022222
Copy link
Author

11111022222 commented Mar 31, 2020

I finally managed to make it work with :

options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--headless')

@jcontini
Copy link
Owner

@vtroussel curious - did you have to do anything else to authentication to work headless? I tried those 3 lines, but it seems that authentication fails for me when I do

@jcontini jcontini reopened this Mar 31, 2020
@11111022222
Copy link
Author

@jcontini I modified the "ENTER" input as a button click. Also augmented the time.sleep but I don't think that is where the problem was coming from.

confirm_id = browser.find_element_by_name("login")
confirm_id.click()
time.sleep(4)

@jcontini
Copy link
Owner

jcontini commented Apr 1, 2020

Awesome, thank you @vtroussel ! This worked for me too. I've used this code to make it headless by default, and it seems to run faster. Appreciate you sharing this, let me know if any other ideas for improvements or feel free to do a pull request.

@jcontini jcontini closed this as completed Apr 1, 2020
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