简体   繁体   中英

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. It works fine locally on my mac, but it doesn't on remote server, Amazon 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

$ 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

Please help me so that I can use Selenium on my Linux. Thanks

I would personally not use Selenium in AWS. 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

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. I find Selenium good but to test locally, where you can see the browser opening and filling forms. 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.
You will also need to install Chrome (and XServer )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM