zoukankan      html  css  js  c++  java
  • 转 ubuntu 安装chrome 和chromedriver

    ubuntu 安装chrome 和chromedriver

    1. chromedriver 下载地址:  https://npm.taobao.org/mirrors/chromedriver

    在这里找到对应的驱动

    2. 安装谷歌浏览器

    2.1 安装依赖 

    apt-get install libxss1 libappindicator1 libindicator7

    2.2 下载Chrome安装包

    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

    2.3 安装

    sudo dpkg -i google-chrome*.deb
    sudo apt-get install -f

    3. 安装chromedriver 

    找到和浏览器对应的驱动

    3.1 安装依赖

    apt-get install unzip

    unzip chromedriver_linux64.zip

    mv -f chromedriver /usr/local/share/chromedriver

    3.2 安装

    #建立软连接
    ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver

    4. 测试(root用户下可用如下脚本)

    复制代码
    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    
    
    options = Options()
    options.add_argument('--headless')
    options.add_argument('--no-sandbox')
    options.add_argument('--disable-dev-shm-usage')
    driver = webdriver.Chrome(executable_path="/usr/local/bin/chromedriver",
                              chrome_options=options)
    print("======")
    driver.get('https://www.cnblogs.com/myvic/')
    print(driver.title)
    print('------------')
    driver.quit()
    复制代码
  • 相关阅读:
    dubbox编译
    fastdfs的启动停止
    fastDFS单机
    Dsu on tree算法
    The 2017 ACM-ICPC Asia Beijing Regional Contest(重现赛)
    2019南京ICPC(重现赛) F
    Codeforces Round #634 (Div. 3)
    Codeforces Round #632 (Div. 2)
    HDU 6521 Party(线段树)
    牛客小白月赛20
  • 原文地址:https://www.cnblogs.com/python-xiakaibi/p/13050434.html
Copyright © 2011-2022 走看看