简体   繁体   English

在 Debian 服务器上使用带有无头模式的 Selenium

[英]Using Selenium with headless mode on Debian server

I am trying to run a python script using selenium in headless mode.我正在尝试在无头模式下使用 selenium 运行 python 脚本。

However, I get this error:但是,我收到此错误:

"selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process"

The same code works well on a normal linux version (not a server one)相同的代码在普通 linux 版本(不是服务器版本)上运行良好

I found the solution.我找到了解决方案。

The problem was due to the wrong installation of firefox on my debian server.问题是由于在我的 debian 服务器上错误安装了 firefox。

After adding the good repository deb http://ftp.fr.debian.org/debian sid main I was able to install firefox-esr and its dependencies via a simple apt install command.添加好的存储库 deb http://ftp.fr.debian.org/debian sid main 后,我能够通过简单的 apt install 命令安装 firefox-esr 及其依赖项。

Once all was installed, the python script worked as expected !安装完毕后,python 脚本按预期工作!

The new problem for me is now to configure www-data user permissions in order to allow it to execute the python script which needs write and execute permissions.我现在的新问题是配置 www-data 用户权限,以允许它执行需要写入和执行权限的 python 脚本。 (Currently encountering (目前遇到

IOError: [Errno 13] Permission denied: 'geckodriver.log' IOError:[Errno 13] 权限被拒绝:'geckodriver.log'

) )

I am looking for a descent solution: allowing its execution as root without password seems too dangerous in terms of security for me..我正在寻找一种下降解决方案:就我的安全性而言,允许它以 root 身份执行而没有密码似乎太危险了..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM