Firefox下载地址

Firefox全历史版本下载:
  http://ftp.mozilla.org/pub/firefox/releases/
  Firefox驱动问题下载  https://github.com/mozilla/geckodriver/releases

我本地测试用的驱动版本:geckodriver-v0.30.0-win64.zip
我本地测试用的火狐版本:92.0

我本地测试用的操作系统:centos7

火狐浏览器解压安装出现的问题

下载火狐版本包,上传,解压(tar jxf)执行命令报错如下:

问题一:
[machangwei@xxx ~]$ ./firefox/firefox
XPCOMGlueLoad error for file /home/machangwei/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM. 问题二: [deployer@xxx firefox]$ ./firefox
XPCOMGlueLoad error for file /apps/svr/firefox/libxul.so:
libXt.so.6: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

问题复现及解决

问题一复现及解决:

问题一缺少gtk3,执行如下命令解决

yum install -y gtk3

如果还不行,把gtk2也装上,回头补充详情

问题二复现及解决:

移除libXt文件,问题复现,重新yum安装,问题解决

[root@localhost ~]# ./firefox/firefox >/dev/null 2>&1 &
[1] 9310
[root@localhost ~]# ps -ef|grep firefox
root 9310 9294 48 09:13 pts/6 00:00:11 ./firefox/firefox
root 9437 9310 9 09:13 pts/6 00:00:01 /root/firefox/firefox-bin -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 248973 -jsInit 285716 -parentBuildID 20210901125518 -appdir /root/firefox/browser 9310 true tab
root 9488 9310 6 09:13 pts/6 00:00:00 /root/firefox/firefox-bin -contentproc -childID 2 -isForBrowser -prefsLen 160 -prefMapSize 248973 -jsInit 285716 -parentBuildID 20210901125518 -appdir /root/firefox/browser 9310 true tab
root 9524 9310 6 09:13 pts/6 00:00:00 /root/firefox/firefox-bin -contentproc -childID 4 -isForBrowser -prefsLen 5583 -prefMapSize 248973 -jsInit 285716 -parentBuildID 20210901125518 -appdir /root/firefox/browser 9310 true tab
root 9541 9294 0 09:13 pts/6 00:00:00 grep --color=auto firefox
[root@localhost ~]# rpm -qa|grep libXt
libXtst-1.2.3-1.el7.x86_64
libXt-1.1.5-3.el7.x86_64 yum remove libXt-1.1.5-3.el7.x86_64
Removed:
libXt.x86_64 0:1.1.5-3.el7 Dependency Removed:
dbus-x11.x86_64 1:1.10.24-15.el7 firefox.x86_64 0:78.14.0-1.el7.centos libXaw.x86_64 0:1.0.13-4.el7 libXmu.x86_64 0:1.1.2-2.el7
xorg-x11-server-utils.x86_64 0:7.7-20.el7 xorg-x11-xauth.x86_64 1:1.0.9-1.el7 xorg-x11-xinit.x86_64 0:1.3.4-2.el7 xterm.x86_64 0:295-3.el7_9.1
[root@localhost ~]# ./firefox/firefox
XPCOMGlueLoad error for file /root/firefox/libxul.so:
libXt.so.6: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
[root@localhost ~]#
yum install -y libXt-1.1.5-3.el7.x86_64
Running transaction
Installing : libXt-1.1.5-3.el7.x86_64 1/1
Verifying : libXt-1.1.5-3.el7.x86_64 1/1 Installed:
libXt.x86_64 0:1.1.5-3.el7
[root@localhost ~]# ./firefox/firefox
Error: no DISPLAY environment variable specified
[root@localhost ~]# yum install -y xorg-x11-server-utils.x86_64 xorg-x11-xinit.x86_64
Installed:
xorg-x11-server-utils.x86_64 0:7.7-20.el7 xorg-x11-xinit.x86_64 0:1.3.4-2.el7 Dependency Installed:
libXmu.x86_64 0:1.1.2-2.el7 xorg-x11-xauth.x86_64 1:1.0.9-1.el7
[root@localhost ~]# ./firefox/firefox
Error: no DISPLAY environment variable specified
[root@localhost ~]# eval `dbus-launch --sh-syntax`
-bash: dbus-launch: command not found
[root@localhost ~]# yum install -y dbus-x11.x86_64
[root@localhost ~]# eval `dbus-launch --sh-syntax`
[root@localhost ~]# ./firefox/firefox
Error: no DISPLAY environment variable specified

重新打开一个会话窗口,成功启动进程

[root@localhost ~]# ./firefox/firefox >/dev/null 2>&1 &
[1] 2333
[root@localhost ~]# ps -ef|grep firefox
root 2333 1891 22 10:40 pts/2 00:00:04 ./firefox/firefox
root 2484 2333 6 10:40 pts/2 00:00:01 /root/firefox/firefox-bin -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 249090 -jsInit 285716 -parentBuildID 20210901125518 -appdir /root/firefox/browser 2333 true tab
root 2536 2333 0 10:40 pts/2 00:00:00 /root/firefox/firefox-bin -contentproc -childID 2 -isForBrowser -prefsLen 96 -prefMapSize 249090 -jsInit 285716 -parentBuildID 20210901125518 -appdir /root/firefox/browser 2333 true tab
root 2601 2333 5 10:40 pts/2 00:00:00 /root/firefox/firefox-bin -contentproc -childID 4 -isForBrowser -prefsLen 5590 -prefMapSize 249090 -jsInit 285716 -parentBuildID 20210901125518 -appdir /root/firefox/browser 2333 true tab
root 2665 2333 2 10:40 pts/2 00:00:00 /root/firefox/firefox-bin -contentproc -parentBuildID 20210901125518 -prefsLen 5590 -prefMapSize 249090 -appdir /root/firefox/browser 2333 true rdd
root 2718 1891 0 10:40 pts/2 00:00:00 grep --color=auto firefox

需要安装的libXt依赖包总结:
libXt.x86_64 dbus-x11.x86_64 firefox.x86_64 libXaw.x86_64 libXmu.x86_64
xorg-x11-server-utils.x86_64 xorg-x11-xauth xorg-x11-xinit.x86_64 xterm.x86_64

[machangwei@aocxxx ~]$ rpm -qa|grep "libXt|dbus-x11|libXaw|libXmu|xorg-x11-server-utils|xorg-x11-xauth|xorg-x11-xinit|xterm"
[machangwei@aocxxx ~]$
firefox

问题3解决乱码:

Centos Firefox中文乱码(对Centos7/8都有效)
yum -y groupinstall Fonts
马上生效。 查看是否安装成功

下载依赖包到本地:

yum install --downloadonly --downloaddir=/root/mcw/prob1 libXt dbus-x11 libXaw libXmu dbus-x11  xorg-x11-server-utils xorg-x11-xauth xorg-x11-xinit xterm
yum groupinstall --downloadonly --downloaddir=/root/mcw/language Fonts

功能测试

windows上打开linux版浏览器测试,正常访问

windows上启用linux版火狐,需要安装图形化界面,安装xmanger,xshell启用xmanager

linux火狐能正常访问

python程序测试火狐浏览器是否能正常使用

from selenium.webdriver.chrome.options import Options
from time import sleep
from selenium import webdriver # 创建一个参数对象,用来控制chrome以无界面模式打开
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
options.add_argument(’–headless’)
options.add_argument(’--no-sandbox’)
options.add_argument(’--disable-dev-shm-usage’)#实例化一个浏览器对象
bro = webdriver.Chrome(executable_path=r'/root/chrome/chromedriver',chrome_options=chrome_options)
bro.get('https://www.baidu.com')
sleep(2)
bro.save_screenshot('1.png')
print(bro.page_source)
sleep(2)
bro.quit()

执行程序,成功截图访问百度的页面

启动Linux版火狐浏览器,需要使用xmanger连接(4a登录的主机无法使用xmanager连接),支持图形化界面才能启动成功,并且在自己笔记本上打开图形化的linux火狐浏览器。
之前进入了一个误区,安装了软件就需要启动。自动化测试只需要使用无头浏览器来调用火狐,启动火狐进程。所以无需安装图形化界面等,只需要解决火狐的缺少的库文件,中文字符之类的问题,就可以使用程序测试是否能正常使用浏览器。

文档整理不全,可参考笔记信息:

yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm

yum install -y http://archives.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm

#wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

#rpm -Uvh epel-release--.noarch.rpm

http://archives.fedoraproject.org/pub/archive/epel/

https://npm.taobao.org/mirrors/chromium-browser-snapshots/Win_x64/884014/
https://download.csdn.net/download/qq_40949759/11593946

启动命令,火狐启动后出来火狐浏览器中文乱码
./firefox/firefox >/dev/null 2>&1 &

/opt/google/chrome/google-chrome --disable-setuid-sandbox --user-data-dir --no-sandbox
/opt/google/chrome/google-chrome --disable-setuid-sandbox --user-data-dir --no-sandbox >/dev/null 2>&1 &

说明dbus没有建立,要安装必要的工具:
# apt-get install dbus-x11
运行 dbus-launch :
# dbus-launch

1.启动Chrome
/usr/bin/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.

修改 /usr/bin/google-chrome文件
将 exec -a "$0" "$HERE/chrome" "$@" 改为
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir --no-sandbox
就可以直接启动了

Ubuntu
链接:https://www.jianshu.com/p/ea9a1a4ab95c

xmanager使用
https://blog.csdn.net/yongwan5637/article/details/84060709
xmanager安装
https://www.xshellcn.com/xiazai.html

启动程序
https://blog.csdn.net/longgeaisisi/article/details/90519690

安装x11
https://blog.csdn.net/h106140873/article/details/107135811

安装xterm,xterm出来小窗口
https://www.jianshu.com/p/23ba123ee874
2.在服务器端vi /etc/ssh/sshd_config,添加一行:需要root,不确定是否开启了的
X11Forwarding yes

dbus命令没有

dbus-x11 yum安装

centos6的源
https://developer.aliyun.com/mirror/

epel 6的源
http://archives.fedoraproject.org/pub/archive/epel/
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
yum install -y http://archives.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm

linux版火狐浏览器部署详解的更多相关文章

  1. legend3---Windows 7/8/10 系统下Laravel框架的开发环境安装及部署详解(Vagrant + Homestead)

    legend3---Windows 7/8/10 系统下Laravel框架的开发环境安装及部署详解(Vagrant + Homestead) 一.总结 一句话总结: 1.安装的话就是下载好git,va ...

  2. centos7.2环境elasticsearch-5.0.1+kibana-5.0.1+zookeeper3.4.6+kafka_2.9.2-0.8.2.1部署详解

    centos7.2环境elasticsearch-5.0.1+kibana-5.0.1+zookeeper3.4.6+kafka_2.9.2-0.8.2.1部署详解 环境准备: 操作系统:centos ...

  3. 【转】Nginx+php-fpm+MySQL分离部署详解

    转:http://www.linuxidc.com/Linux/2015-07/120580.htm Nginx+php-fpm+MySQL分离部署详解 [日期:2015-07-26] 来源:Linu ...

  4. [r]Ubuntu Linux系统下apt-get命令详解

    Ubuntu Linux系统下apt-get命令详解(via|via) 常用的APT命令参数: apt-cache search package 搜索包 apt-cache show package ...

  5. Solr部署详解

    Solr部署详解 时间:2013-11-24 方式:转载 目录 1 solr概述 1.1 solr的简介 1.2 solr的特点 2 Solr安装 2.1 安装JDK 2.2 安装Tomcat 2.3 ...

  6. MySql绿色版配置及使用详解

    原文:MySql绿色版配置及使用详解 最近在做项目开发时用到了MySql数据库,在看了一些有关MySql的文章后,很快就上手使用了.在使用的过程中还是出现了一些问题,因为使用的是绿色免安装版的MySq ...

  7. Linux文件系统的目录结构详解

    Linux文件系统的目录结构详解   一.前 言 文章对Linux下所有目录一一说明,对比较重要的目录加以重点解说,以帮助初学者熟练掌握Linux的目录结构. 二.目 录 1.什么是文件系统 2.文件 ...

  8. MySQL高可用方案-PXC(Percona XtraDB Cluster)环境部署详解

    MySQL高可用方案-PXC(Percona XtraDB Cluster)环境部署详解 Percona XtraDB Cluster简称PXC.Percona Xtradb Cluster的实现是在 ...

  9. linux下getsockopt和setsockopt详解及测试

    linux下getsockopt和setsockopt详解及测试 NAME 名字 getsockopt, setsockopt - get and set options on sockets 获取或 ...

随机推荐

  1. Focal Loss(RetinaNet)笔记 一种减小类别不平衡影响的方法

    Paper: https://arxiv.org/abs/1708.02002 还参考了:https://www.jianshu.com/p/8e501a159b28 其中p是预测属于某类的概率.

  2. VSCode中相对路径设置问题

    使用的版本 对于import xxx操作,相对路径为sys.path 对于open("test.txt",'r')文件打开操作,相对路径为os.getcwd() 对于termina ...

  3. rsync 服务搭建

    rsync 服务搭建 服务端部署操作内容: 创建rsync用户和用户组 eg: useradd -s /sbin/nologin -M rsync 创建需要备份的指定目录,并修改权限 eg: mkdi ...

  4. SpringBoot快速集成SpringBootAdmin管控台监控服务

    SpringBootAdmin是一个针对 Spring Boot 的 Actuator 接口进行 UI 美化封装的监控工具,它可以在列表中浏览所有被监控 spring-boot 项目的基本信息.详细的 ...

  5. 前端路由原理之 hash 模式和 history 模式

    什么是路由? 个人理解路由就是浏览器 URL 和页面内容的一种映射关系. 比如你看到我这篇博客,博客的链接是一个 URL,而 URL 对应的就是我这篇博客的网页内容,这二者之间的映射关系就是路由. 其 ...

  6. 20210808 Hunter,Defence,Connect

    考场 乍一看都不可做 T1 算了半天样例,一直算出来 \(\frac{81}{400}\),直接丢了 T1 推了推发现是求最长连续 \(0\) 的数量,那就是线段树合并加上<玫瑰花精> T ...

  7. Python常见问题 - python3 使用requests发送HTTPS请求报certificate verify failed 错误

    当你使用 requests 发送HTTPS请求时 requests.get(url, parmas=parmas, headers=header, cookies=cookie) 出现了以下错误 HT ...

  8. Junit5快速入门指南-3

    Fixtures 是测试中非常重要的一部分.他们的主要目的是建立一个固定/已知的环境状态以确保 测试可重复并且按照预期的方式运行.比如在app测试中 基类@BeforeClass 配置初始化,初始化d ...

  9. Identity用户管理入门四(修改、删除用户)

    修改用户不能修改Id及用户名所以创建视图模型时需要去除,新增用户跟修改用户基本视图一直,所以不再做演示 一.新建UpdateUserViewModel视图模型 using System.Compone ...

  10. VUE005. 在data中使用 / 改变data,或在data中调用method函数

    使用三方UI库时经常会遇到在data中写入方法的场景,如Element-UI的级联选择器(动态加载part)需要在data中写入lazyLoad. 但后端总会给出意想不到的需求: 通过接口调取一串数据 ...