zoukankan      html  css  js  c++  java
  • linux 无界面环境安装chrome,chromedriver,selenium

    注意 chrome和chromedriver 大版本号要一致

    一、安装chrome

    1. 下载安装脚本,

    在下载目录中,执行以下命令,将安装脚本下载到本地

    wget https://intoli.com/install-google-chrome.sh
    

      

    2.然后授予可执行权限

    chmod 755 ./install-google-chrome.sh
    

      

    3.执行脚本

    ./install-google-chrome.sh
    

    安装脚本会自动下载、安装chrome(合适的版本),并且目前两个系统中,所缺少的依赖,都会被安装。

    4.测试安装结果

    执行命令, 

    google-chrome-stable --no-sandbox --headless --disable-gpu --screenshot https://www.baidu.com/
    

      

    如果在当前文件夹中出现screenshot.png  则安装成功

    5.查看linux 安装的谷歌浏览器版本

    # google-chrome --version
    Google Chrome 83.0.4103.106
    

      

    二、安装chromedriver

    1. 在  https://npm.taobao.org/mirrors/chromedriver中找到对应版本的chromedriver

    2.下载文件包

    wget https://npm.taobao.org/mirrors/chromedriver/75.0.3770.90/chromedriver_linux64.zip
    

      

    3.解压文件包

    unzip chromedriver_linux64.zip
    

      

    解压后,在/opt/google/ 会多出一个文件chromedriver

    4.修改chromedriver 执行权限

    chmod +x chromedriver
    

      

    5.连接文件

    ln -s /opt/google/chromedriver /usr/bin/chromedriver 

    三.安装selenium

    yum install Xvfb
    
    pip install pyvirtualdisplay
    
    pip install selenium
    

      

  • 相关阅读:
    Winefish-GTK LaTeX 编辑器
    GPuTTY:SSH 会话治理器
    Zudeo──高清版 Youtube
    HardInfo-体系信息搜集对象
    Liferea 1.2.0 正式版
    HomeBank:家庭理财软件
    ParolaPass:暗码天生器
    VLC Media Player 0.8.6
    流程图的绘制方法
    Delphi 2009 中的匿名方法(reference to)
  • 原文地址:https://www.cnblogs.com/zxqblogrecord/p/13171516.html
Copyright © 2011-2022 走看看