Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
115 views
in Technique[技术] by (71.8m points)

python - Flask + Selenium + Ubuntu + Apache

I'm breaking my head here trying to get the Selenium Driver/Chromedriver to work on a Flask project on Ubuntu server 20.04, Python3.8. The application runs perfectly when on stand alone, and on Debug mode. But when I run it behind the web server, Apache2 with the WSGI module, it does not work right. the message I'm greeting is "Chromedriver quite unexpectedly".

Again Chromedriver works well, path is correct and when I run it on debub on the server or even standalone remotely it work really great.

I'm runing out of options here if anyone could help I woud really appreciate it.

This is how I'm opening Chromedriver on my code:

    options = Options()
    options.add_argument("--headless")
    options.add_argument("--disable-gpu")
    options.add_argument("--no-sandbox")
    options.add_argument("enable-automation")
    options.add_argument("--disable-infobars")
    options.add_argument("--disable-dev-shm-usage")
    
    driver = webdriver.Chrome(executable_path="/usr/lib/chromium-browser/chromedriver", options=options)

Looking at the log from Apache this is the message I'm getting

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (chrome not reachable)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-66-generic x86_64)
question from:https://stackoverflow.com/questions/65640769/flask-selenium-ubuntu-apache

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...