【发布时间】:2021-02-05 01:52:43
【问题描述】:
我已经在 heroku 中部署了 python 应用程序。该应用程序主要使用硒。每当我打开应用程序时,它都会开始新的 selenium 会话。我想在同一个硒会话中发生,这怎么可能? 这是我的 chrome_options。
options = Options()
options.binary_location = os.environ.get("GOOGLE_CHROME_BIN")
options.add_argument("--disable-infobars")
options.add_argument("--disable-extensions")
options.add_argument("--headless")
options.add_argument("--no-sandbox")
options.add_argument('--single-process')
options.add_argument('--disable-gpu')
options.add_argument('--remote-debugging-port=9222')
options.add_argument('--disable-browser-side-navigation')
browser = webdriver.Chrome(options=options, executable_path=os.environ.get("CHROMEDRIVER_PATH"))
options.add_argument("--example-flag")
过程文件
web gunicorn app:app
【问题讨论】:
-
你能显示
Prcofile吗? -
@Darkknight 添加
标签: python selenium selenium-webdriver heroku selenium-chromedriver