简体   繁体   English

如何在Amazon Linux上使用带有chrome驱动程序的selenium。 错误:Selenium :: WebDriver :: Error :: UnknownError:未知错误:找不到Chrome二进制文件

[英]How to use selenium with chrome driver on Amazon Linux. error: Selenium::WebDriver::Error::UnknownError: unknown error: cannot find Chrome binary

I'm trying to use selenium-webdriver on Linux in my Rails project. 我正试图在我的Rails项目中使用Linux上的selenium-webdriver。 It works fine locally on my mac, but it doesn't on remote server, Amazon Linux. 它在我的Mac上本地工作正常,但它不在远程服务器,亚马逊Linux上。

Here is the machine info 这是机器信息

$ uname --all
Linux ip-172-31-21-116 4.4.10-22.54.amzn1.x86_64 #1 SMP Tue May 17 22:45:04 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

And this is the error I've got. 这就是我得到的错误。

Selenium::WebDriver::Error::UnknownError: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.22.397932 (282ed7cf89cf0053b6542e0d0f039d4123bbb6ad),platform=Linux 4.4.10-22.54.amzn1.x86_64 x86_64)

I installed the chromedriver and put /usr/local/bin 我安装了chromedriver并放入/usr/local/bin

$ ls -al /usr/local/bin
-rwxrwxrwx  1 root root 5952376 Jun  4 12:54 chromedriver

This is what I installed http://chromedriver.storage.googleapis.com/2.22/chromedriver_linux64.zip 这就是我安装的http://chromedriver.storage.googleapis.com/2.22/chromedriver_linux64.zip

Please help me so that I can use Selenium on my Linux. 请帮助我,以便我可以在我的Linux上使用Selenium。 Thanks 谢谢

I would personally not use Selenium in AWS. 我个人不会在AWS中使用Selenium。 I tried http://phantomjs.org that is a similar concept but without the requirement of a browser Phantom has a Full web stack plus no browser required 我尝试了http://phantomjs.org这是一个类似的概念,但没有浏览器的要求Phantom有一个完整的Web堆栈,不需要浏览器

The only thing is that may take quite a while to compile, but give it a try, and you will have no more headaches with Selenium. 唯一的问题是可能需要很长时间才能编译,但是试一试,你不会再对Selenium产生麻烦了。 I find Selenium good but to test locally, where you can see the browser opening and filling forms. 我发现Selenium很好,但要在本地测试,在那里你可以看到浏览器打开和填写表单。 But on the server I would use something different, that runs silently with minimun requirements and can be run from command-line without a browser. 但是在服务器上我会使用不同的东西,它们以最小的要求静默运行,并且可以在没有浏览器的情况下从命令行运行。

What you've installed is just the Chrome WebDriver binding. 您安装的只是Chrome WebDriver绑定。
You will also need to install Chrome (and XServer ) 您还需要安装Chrome (和XServer

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Selenium::WebDriver::Error::UnknownError: 未知错误: Chrome 启动失败: 异常退出 - Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally Net :: ReadTimeout:Net :: ReadTimeout和Selenium :: WebDriver :: Error :: UnknownError:未知错误:Chrome无法启动Rails 5.1.beta系统测试 - Net::ReadTimeout: Net::ReadTimeout and Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start on Rails 5.1.beta System Test Docker-compose 测试 Selenium 失败 / Selenium::WebDriver::Error::UnknownError: unknown error:.net::ERR_CONNECTION_REFUSED - Docker-compose testing with Selenium fails / Selenium::WebDriver::Error::UnknownError: unknown error: net::ERR_CONNECTION_REFUSED 如何修复 WSL2 中的“Selenium::WebDriver::Error::WebDriverError: chrome notreachable” - How to fix "Selenium::WebDriver::Error::WebDriverError: chrome not reachable" in WSL2 Selenium::WebDriver::Error::UnknownError: 无效的内容类型 - Selenium::WebDriver::Error::UnknownError: Invalid Content-Type Selenium Web驱动程序错误 - Selenium Web Driver Error 使Selenium WebDriver在RSpec / Rails中使用Chrome - Getting Selenium WebDriver to use Chrome in RSpec/Rails 如何访问 cookies(Capybara/Selenium Chrome Webdriver) - How to access cookies (Capybara/Selenium Chrome Webdriver) Selenium 不适用于 Heroku (Selenium::WebDriver::Error::SessionNotCreatedError) - Selenium not working on Heroku (Selenium::WebDriver::Error::SessionNotCreatedError) Selenium Webdriver Zoom with Ruby for Chrome - Selenium webdriver zoom with Ruby for Chrome
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM