我想使用Selenium在我的服务器上构建爬虫。
因此,我已经在我的Ubuntu17.10服务器上安装/下载了所需的依赖项,例如chromedriver,chromium-browser等。
但是,当我运行以下代码时:
driver = webdriver.Chrome()
它返回以下错误:
---------------------------------------------------------------------------
WebDriverException Traceback (most recent call last)
<ipython-input-14-2cdab8938403> in <module>()
----> 1 driver = webdriver.Chrome()
/home/zachary/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options)
66 service_args=service_args,
67 log_path=service_log_path)
---> 68 self.service.start()
69
70 try:
/home/zachary/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py in start(self)
96 count = 0
97 while True:
---> 98 self.assert_process_still_running()
99 if self.is_connectable():
100 break
/home/zachary/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py in assert_process_still_running(self)
109 raise WebDriverException(
110 'Service %s unexpectedly exited. Status code was: %s'
--> 111 % (self.path, return_code)
112 )
113
WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127
什么意思它被“excited”了?
我不知道这个错误代码的原始意图是什么,也不知道从哪里开始修复它。
这似乎是一个非常罕见的情况。
可能相关:
我在我的台式机上安装了Ubuntu桌面版17.10,但无法获得GUI引导。因此,我只能使用终端,但目前它运行良好。 我已经安装了ssh和远程控制jupyter笔记本电脑从我的Mac到服务器台式机,并且这些错误来自于它。 希望这些信息有助于解决这个错误,否则将会放弃它。
--version
运行),以及如何使用apt-cache search
。这真的对我有很大帮助,谢谢! - Samlibglib2.0-0 \ libnss3 \ libgconf-2-4 \ libfontconfig1 \
我正在docker中运行,所以我还需要添加curl -LO $CHROMIUM_DRIVER_LOCATION unzip chromedriver_linux64.zip
到我的入口点,并以无头模式运行我的驱动程序。 - aaronldd
。例如:ldd /opt/chromedriver/x.xx/chromedriver
,它将显示一个.so文件列表。搜索未找到的文件。这至少是一个较少迭代的过程。 - Codebling