0

我正在尝试在 Manjaro Linux 上的 Python 中运行它。

我已经编写了一些我们希望在办公室的屏幕上运行的功能测试。但是,只有当我通过一个--headless我们绝对不想要的选项时,测试才有效。否则,我们得到的恒定误差是The process started from chrome location /opt/google/chrome/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.。因此,当我传递--headless参数时,这个错误立即消失了,这在这一点上非常令人沮丧。这是我现在正在尝试的代码:

 options = Options()
 options.add_argument("--no-sandbox")
 options.add_argument("--window-size=1920,1080")
 options.add_argument("--disable-gpu")
 options.add_argument("--disable-extensions")
 options.add_argument("--start-maximized")
 # options.add_argument("--headless")
 driver = webdriver.Chrome("/usr/bin/chromedriver", chrome_options=options)

任何提示都非常感谢!谢谢!

4

1 回答 1

0

这可能是因为您的 chrome 未安装在默认位置。这里给出了详细的解释。您可以使用以下选项指定运行 chrome 的位置:

# chrome binary location specified here
options.binary_location = "/opt/google/chrome/google-chrome"
于 2020-02-18T09:24:29.547 回答