I have the same error as this post:
Howerver it seems as I have different issue - managing versions does not solve it.
I am trying to use Google Cloud Functions (2nd tear which is based on Cloud Run) to run Seleniu.
My code is just the basic one:
main.py:
def hello_world(request):
print("Start")
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from chromedriver_py import binary_path
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
chrome_options = Options()
chrome_options.binary_location=binary_path
chrome_options.add_argument("--remote-debugging-port=9222")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--window-size=1920x1080")
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-extensions')
driver = webdriver.Chrome(options=chrome_options,service=Service(ChromeDriverManager().install()))
driver.get("https://www.google.com")
print(driver.title)
driver.close()
print("End")
return "Empty - nothing"
requirements.txt:
selenium >= 4.2.0
webdriver-manager >= 3.7.0
chromedriver_py >= 103.0.5060.24
It gives error: "selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally"
Has anyone figured it out?
I found information that cloud functions does not work with Selenium: Can I use Selenium WebDriver with Google Cloud Functions?
However I set it on 2nd gen environment, which is based on Cloud Run, so I wish there is a way to make it work...