Ubuntu 18.04+selenium 错误 can't kill an exited process

如以下错误:

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

2.或selenium.common.exceptions.WebDriverException:Message: Process unexpectedly closed with status:1

selenium出现这个错误是因为脚本在root用户下运行导致,若你用的是firefox,firefox geckodriver的log中出现以下错误提示:
Running Firefox as root in a regular user's session is not supported. ($HOME is /root which is owned by www.)

使用chrome也有类似报错;

明确原因是Firefox不支持root用户;

解决方案:
1.新建新用户
2.在新用户下运行相应的脚本
3.如果有文件的读写权限问题,请赋予相应的权限

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容