多试试
对于谷歌Chrome32位版本,使用如下链接:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
对于64位版本可以使用如下链接下载:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
下载完后,运行如下命令安装。
sudo dpkg -i google-chrome*;
sudo apt-get -f install
然后就搞定了!安装完成后,到Unity Dash搜索Chrome就可以启动它了。
但是但是:
还是可能会出现问题的:
1.启动Chrome浏览器
# google-chrome
这时会报错:
[31560:31560:0207/085601.085852:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
解决方法:
- # whereis google-chrome
- google-chrome: /usr/bin/google-chrome /usr/share/man/man1/google-chrome.1.gz
- # vim /usr/bin/google-chrome
将 exec -a "$0" "$HERE/chrome" "$@" 改为
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir --no-sandbox
以后只要 google-chrome 就可以打开Chrome了
问题2:browser_main_loop.cc(143)] Running without the SUID sandbox!。。。
解决办法:
/opt/chrome-linux/chrome --disable-setuid-sandbox
问题3:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.10.0-42-generic x86_64)
Start the Display before start the Chrome.
先执行一下两句安装命令(以ubuntu为例):
- pip install pyvirtualdisplay
- sudo apt-get install xvfb
然后添加如下代码:
from pyvirtualdisplay import Display
- display = Display(visible=0, size=(800, 800))
- display.start()
- driver = webdriver.Chrome()