-
Notifications
You must be signed in to change notification settings - Fork 134
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
Chromedriver unexpectedly exited. #161
Comments
Make sure to add the following to the options of your Chrome driver: from selenium import webdriver
from tempfile import mkdtemp
def my_fn():
options = webdriver.ChromeOptions()
options.binary_location = '/opt/chrome/chrome'
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument("--disable-gpu")
options.add_argument("--window-size=1280x1696")
options.add_argument("--single-process")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--disable-dev-tools")
options.add_argument("--no-zygote")
options.add_argument(f"--user-data-dir={mkdtemp()}")
options.add_argument(f"--data-path={mkdtemp()}")
options.add_argument(f"--disk-cache-dir={mkdtemp()}")
options.add_argument("--remote-debugging-port=9222")
chrome = webdriver.Chrome("/opt/chromedriver", options=options) Hope it helps, @suyash-web. |
Thanks, @x-N0, for the comment! |
Hey, @suyash-web, good to know you managed to solve the issue; About your intent to include LibreOffice, doesn't that kind of software need a whole GUI framework to be installed? To me that'd seem a bit huge, what about using other terminal-based tools that usually are lighter? Or even use some python script to decompose and recompose the files together after you do whatever you need to do with them in LibreOffice? I hope you get your project going soon! |
Thanks for the response, @x-N0 ! I have considered using terminal-based alternatives like About using Python scripts, I tried using modules like I've also considered using APIs by Aspose, smallpdf, Adobe, and similar, but they're all paid. The free versions have a limit and include a watermark in the final pdf. |
Hello,
script.py where I'm defining driver:
My Dockerfile:
|
I'm running into the same issue as @notanmay. The images work remotely on non-apple silicon though. |
I tried to use the same options block code, but I got this error after that when trying to run on docker container with Ubuntu 22.04 as base image.
I'm using: Can you check it on your side @x-N0 ? Thank you in advance |
Hi,
It can also add images to the pdf document. Just place the image path in |
If you have M1 Macbook and find difficulty to try on local, how about this? My M1 Macbook is okay so far. |
Also please see #12 (comment) |
@umihico - Can you please guide how to use chrome driver and chrome without docker. I am using AWS lambda to do some web automation using selenium. Lastly the config worked on python 3.7 selenium 3.14 chrome and chromium 88. I tried your chrome driver and chrome browser version 114 but ended in error below "errorMessage": "Message: Service /tmp/chrome/chromedriver unexpectedly exited. Status code was: 127\n", |
@lambertrezon |
@umihico - I have downloaded the chrome driver and chrome browser with the links provided. Zipped the library and attached to the S3.While program execution this library is copied to /tmp directory and then Copied the same sample code which you have used. import os
|
The main ideal that you should use the same version of Chrome and Chromium, but I suggest that you should run your chromedriver by Docker due to it supports up to 10GB for both source code and dependencies while the zip layer upload will be limited at 250MB ( which hard for you to handle layer of chrome or the other dependencies ). I did test it and only zip packed file of ( chromedriver & chrome ) took over 500MB and when I compress this zip file, it just can only reduce a half to around 225MB ~ 230MB which means only 20MB available space for both your source code and dependencies. So please be careful to consider which way is fix for your work. By the way, I found the stable version you could use for test The stable chromedriver: https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip or you can find more version at https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html |
Previously i had python 3.7 and chrome driver, headless chromium 88 which was running smoothly. Since I upgraded to python 3.11 i had to update everything. Is there any possibility to get headless chromium for latest chrome |
@lambertrezon |
@umihico All the dependency are downloaded dynamically when the lambda function starts to execute |
Im not using this image but one constructed myself and ran into a similar issue, when chrome was exiting it writes a core dump to |
@boilsquid can you please share me the method or project which worked for you. |
I can't share my Dockerfile but its effectively the same as this build, this gist is what got it working for me. |
I'm also getting the same error . Is there any fix for this ? |
The problem was that I placed the chrome binary on the wrong directory with a declaration for the code block. Furthermore, you can check more this issue which I mentioned here #161 (comment) Let me know if it solves your problem |
I don't know what solved my problem. But , When i ran my lambda function today in morning, It didn't throw any error. And Yah, If it works : Don't touch it! |
One more thing, we should stay the both chromedriver and chrome at 114 ( please be sure that match with a prefix as well ). It should work over time, due to version above 115 are on test stage, not a stable version |
Had the same error, you can check if the chromedriver starts by inserting this command in your Dockerfile |
Hello, I am also facing the same issue, I am trying this on lambda Following is my code: from selenium import webdriver def lambda_handler(event=None, context=None):
"errorMessage": "Message: Service /mnt/access/chrome/chromedriver unexpectedly exited. Status code was: 127\n",
|
Hi, thanks for creating the image. It worked for me!
It was working well until recently when I encountered the error [
ERROR] WebDriverException: Message: Service /opt/chromedriver unexpectedly exited. Status code was: 127
when I ran the code on AWS lambda.What could possibly be causing this error? If it has something to do with the chrome version then can you please help me with how to update it with the compatible version.
Thank you.
The text was updated successfully, but these errors were encountered: