zoukankan      html  css  js  c++  java
  • Linux服务器安装chrome并支持中文显示

    Linux服务器安装chrome

    cd /etc/yum.repo.d/
    touch google-chrome.repo
    

    编辑google-chrome.repo

    [google-chrome]
    name=google-chrome
    baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
    enabled=1
    gpgcheck=1
    gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
    

    安装

    yum -y install google-chrome-stable --nogpgcheck
    

    查看chrome版本:

    google-chrome --version
    

    下载对应版本chromedriver

    查看版本列表:http://npm.taobao.org/mirrors/chromedriver

    版本对应列表

    chrome版本	chromedriver版本
    86.0.4240.22	86
    85.0.4183.87	85
    85.0.4183.83	85
    85.0.4183.38	85
    84.0.4147.30    84
    83.0.4103.39	83
    83.0.4103.14	83
    81.0.4044.138	81
    81.0.4044.69	81
    81.0.4044.20	81
    80.0.3987.106	80
    80.0.3987.16	80
    79.0.3945.36	79
    79.0.3945.16	79
    78.0.3904.105	78
    78.0.3904.70	78
    78.0.3904.11	78
    77.0.3865.40	77
    77.0.3865.10	77
    76.0.3809.126	76
    76.0.3809.68	76
    76.0.3809.25	76
    76.0.3809.12	76
    75.0.3770.90	75
    75.0.3770.8		75
    74.0.3729.6		74
    73.0.3683.68	73
    72.0.3626.69	72
    2.46			71-73
    2.45			70-72
    2.44			69-71
    2.43			69-71
    2.42			68-70
    2.41			67-69
    2.4 			66-68
    2.39			66-68
    2.38			65-67
    2.37			64-66
    2.36			63-65
    2.35			62-64
    

    下载和浏览器对应版本驱动然后安装

    wget http://npm.taobao.org/mirrors/chromedriver/85.0.4183.87/chromedriver_linux64.zip
    unzip chromedriver_linux64.zip
    chmod +x ./chromedriver
    

    使用

    可正常启用但是chrome中文显示乱码找不到指定元素导致脚本执行失败

    查看修改服务器字符集

    [root@192-168-17-194 htms-op-ui-automation-test]# echo $LANG
    en_US.UTF-8
    

    确认系统是否支持中文字符集

    locale -a |grep CN
    

    Centos7修改系统默认字符集

    vim /etc/locale.conf
    # LANG="en_US.UTF-8"
    LANG="zh_CN.UTF-8"
    

    安装中文字符集支持

    yum -y groupinstall "X Window System"
    yum -y groupinstall chinese-support # Centos7如果报错找不到chinese-support可忽略
    yum -y groupinstall Fonts 
    

    重启系统

  • 相关阅读:
    缩略图架构实现
    基于GDAL实现的PCA变换(主成分分析)
    【OpenGL】GLSL中的函数和子程序(subroutines)
    【OpenGL】关于OpenGL中Bind函数的理解
    使用MTL库求解矩阵特征值和特征向量
    C#键盘事件列表
    C#用 SendKyes 结合 Process 或 API FindWindow、SendMessage(PostMessage) 等控制外部程序
    什么是句柄
    在DLL中产生对话框的方法一(Win32 DLL)
    C# 四舍五入
  • 原文地址:https://www.cnblogs.com/aquichita/p/13713525.html
Copyright © 2011-2022 走看看