无效参数:无法杀死已退出的进程,使用geckodriver在Python中运行Selenium

问题描述 投票:0回答:1

OS:Ubuntu 18.04.3 LTSGeckodriver版本:0.26Firefox版本:76.0.1Python版本:3.6.9硒版本:3.141.0

我的代码:

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver_options = Options()
driver_options.headless = True
browser = webdriver.Firefox(options=driver_options)

... do stuff

首先,此安装程序在我的mac电脑上正常运行,当我将其发送到生产环境时,出现该错误。我已经尝试修复了两天。

我发现了两个可能导致此问题的主要因素:

1590245018121   mozrunner::runner   INFO    Running command: "/var/www/mycode/env/bin/firefox" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile7raE8H"
/var/www/mycode/env/bin/firefox: 1: /var/www/mycode/env/bin/firefox: which: not found
python selenium ubuntu gunicorn geckodriver
1个回答
0
投票

由于我可以从终端运行脚本,所以我最终意识到他的问题是金枪鱼。我必须添加Environment="PATH=/usr/bin"服务器上运行的gunicorn服务脚本。

© www.soinside.com 2019 - 2024. All rights reserved.