Python selenium模块报错解决

      在使用selenium的webdriver示例化Firefox和Chrome对象时,发现如下报错。

如上图,实例Firefox对象,报错:selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process

如上图,实例化Chrome对象,报错:selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally

     检查对应的驱动,是已经放到PATH变量路径的。

如上图,geckodriver,chromedriver已经放置到/usr/local/bin目录下,且有+x权限。

最开始怀疑是和目前已经打开的火狐和chrome浏览器冲突,于是关闭本机对应的火狐和chrome浏览器,执行上述代码,报错依旧。

后面切换到用普通用户执行,发现可以正常运行。

原文地址:https://www.cnblogs.com/360linux/p/13062067.html