我在设置的网格上运行 Chrome 实例时遇到问题
我收到以下错误:
ERROR [21] org.openqa.selenium.os.UnixProcess - org.apache.commons.exec.ExecuteException:
Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program
"/tmp/webdriver/chromedriver/chromedriver_2.13_32bit" (in directory "."): error=2, No such
file or directory)
我向您保证 /tmp/webdriver/chromedriver/chromedriver_2.13_32bit
也存在可执行文件 (chmod +x)
我运行节点的参数:
java -jar selenium-server-standalone-2.44.0.jar -port 5555 -role node -hub http://10.20.102.176:4444/grid/register -nodeConfig /opt/selenium/node_5555.json -Dwebdriver.chrome.driver=/tmp/webdriver/chromedriver/chromedriver_2.13_32bit
如果未提供驱动程序的路径,甚至可以将符号链接(symbolic link)
设置为selenium所在的默认位置
/usr/local/bin/chromedriver
/usr/bin/chromedriver
但是当我尝试运行某些东西时仍然遇到相同的错误。
额外信息 - 也许会有帮助:
我还尝试在该机器上从 python 运行 chrome 实例
from selenium.webdriver import Chrome
a = Chrome('/tmp/webdriver/chromedriver/chromedriver_2.13_32bit')
我得到的回溯是:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'path'
>>> a = Chrome('/tmp/webdriver/chromedriver/chromedriver_2.13_32bit')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 59, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/service.py", line 66, in start
"ChromeDriver executable needs to be available in the path. "
selenium.common.exceptions.WebDriverException: Message: ChromeDriver executable needs to be available in the path. Please download from http://chromedriver.storage.googleapis.com/index.html and read up at http://code.google.com/p/selenium/wiki/ChromeDriver
我通过 chromedriver-users 寻求帮助Google 群组,但没有得到回复。
我错过了什么吗?
最佳答案
问题是,我试图在 64 位系统中运行 32 位 bin 文件。
有两种解决方案:
我的服务器缺少ia32-lib
- 事实证明,你不能只在 64 位系统中运行 32 位
我所要做的就是:sudo apt-get install ia32-libs
添加对 32 位的支持
或者
只需下载并使用 64 位 Chromedriver
关于python - 带有 selenium gird 的 chromedriver - 没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27886011/