如何在Debian9上安装适用于Python3的SeleniumWebdriver



我花了大约6个小时尝试安装Selenium。我认为我的各种错误源于版本兼容性或缺乏必备软件包。我在servercheap.net的OpenVZ VPS上使用Debian 9。这个VPS没有预装很多软件包,所以我不得不手动安装python之类的东西。有人能写一个循序渐进的过程来在Debian9的新重建上安装Python3-selenium吗?请同时指定Web驱动程序和版本号。

至于我得到的错误,这里有几个:

Message: 'geckodriver' executable needs to be in PATH
Message: invalid argument: can't kill an exited process
Message: Process unexpectedly closed with status 1
Message: Service chromedriver unexpectedly exited. Status code was: 127

我希望能够在没有错误的情况下运行以下Python3脚本:

from selenium import webdriver
browser = webdriver.Firefox() #or webdriver.Chrome()

根据这个答案中的示例,您只需要确保程序知道可执行文件的位置

from selenium import webdriver
browser = webdriver.Firefox(r'yourpathgeckodriver.exe') #or webdriver.Chrome()

最新更新