Forums

Selenium / Chromedriver script working fine in console but crashing when run as a task

Hello, I have a selenium script that runs perfectly fine when executing from the console, and previously was working fine as a daily task for several months. As of last week, without any code changes, it now fails when run as a task, but still works fine when executing from the console. This is the error traceback - any ideas?

What would the differences be between running as a task vs manually running?

Thanks, Rory

Traceback (most recent call last): File "FixtureScraping/LineUps/automated_lineups.py", line 18, in <module> browser = browser_login() File "/home/roryjbd/FixturesProject/FixtureScraping/LineUps/teamsheet_ur.py", line 14, in browser_login browser = webdriver.Chrome(options=chrome_options) File "/home/roryjbd/.virtualenvs/fixtures/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__ RemoteWebDriver.__init__( File "/home/roryjbd/.virtualenvs/fixtures/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "/home/roryjbd/.virtualenvs/fixtures/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/home/roryjbd/.virtualenvs/fixtures/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/home/roryjbd/.virtualenvs/fixtures/lib/python3.8/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: crashed (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 5.13.0-1017-aws x86_64)

The most likely cause of that is that you are in the tarpit when it's failing on the task server. Being in the tarpit has a much larger effect on the task servers than it does on console servers.

Is that linked to my CPU seconds? Because I’m only using ~4% of my 2000s a day

Are you passing all chrome options from the example --no-sandbox is obligatory after recent security updates.

Adding the --no-sandbox appears to have fixed it, thanks very much!

Great, thanks for confirming!