Heroku和Python上的Selenium Webdriver超时异常

Heroku和Python上的Selenium Webdriver超时异常,python,selenium,heroku,webdriver,pythonanywhere,Python,Selenium,Heroku,Webdriver,Pythonanywhere,我正在做一个项目,在这个项目中,我的脚本截图显示tweet代码在本地服务器上运行,但我在heroku和Pythonywhere两个平台上都出现超时异常错误。。我试过多次修改代码,这是我上传到heroku上的代码,附在这个问题上 from flask import Flask, render_template, request, url_for, redirect,session,send_file from selenium import webdriver import os from sel

我正在做一个项目,在这个项目中,我的脚本截图显示tweet代码在本地服务器上运行,但我在heroku和Pythonywhere两个平台上都出现超时异常错误。。我试过多次修改代码,这是我上传到heroku上的代码,附在这个问题上

from flask import Flask, render_template, request, url_for, redirect,session,send_file
from selenium import webdriver
import os
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--headless')
chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN")


app = Flask(__name__,
            static_url_path='', 
            static_folder='static',
            template_folder='templates'
)
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
app.secret_key = "Super Secret Key"

@app.route('/')
def index():
   if 'success' in session:
      session.pop('success',None)
      return render_template('index.html',success=True)
   elif 'error' in session:
      session.pop('error',None)
      return render_template('index.html',error=True)
   elif 'file' in session:
      session.pop('file',None)
      return send_file("static/images/screenshot.png",as_attachment=True)
   else:
      return render_template('index.html')

@app.route('/check',methods = ['POST', 'GET'])
def check():
   if request.method == 'POST':
      try:
         download = request.form['auto_download']
         download = True
      except:
         download = False
      try:
         driver = webdriver.Chrome(executable_path=os.environ.get("CHROMEDRIVER_PATH"),options=chrome_options)
         url = request.form['url']
         #driver.implicitly_wait(30)
         driver.get(url)
         wait = WebDriverWait(driver, 10)
         element = wait.until(EC.element_to_be_clickable((By.TAG_NAME, 'article')))
         elem = driver.find_element_by_tag_name("article")
         elem.screenshot("static/images/screenshot.png")
         driver.close()
         if download == True:
            session['file'] = "True"
            return redirect(url_for("index"))
         else:
            session['success'] = "True"
            return redirect(url_for("index"))
      except Exception as err:
         return f"{err.__class__.__name__}: {err}"
         #session['error'] = "True"
         #return redirect(url_for("index"))
   else:
      return redirect(url_for('index'))


if __name__ == '__main__':
   app.run()

您得到的完整错误堆栈跟踪是什么,是哪一行引起的?