问题描述
我正在使用非常复杂的设置来测试各种非公开网页.我使用jenkins
在docker
图像中运行python-selenium
测试.这样,我完全独立于詹金斯环境,并且可以创建自己的环境.在这种环境中,我安装了以下软件:
I am using a very complex setup to test various non-public webpages. I use jenkins
to run the python-selenium
tests within a docker
image. That way, I am completely independent of the jenkins environment and can create my own environment. In this environment I have the following software installed:
- Ubuntu 16.04.3
- Firefox:Mozilla Firefox 57.0.1
- 壁虎驱动程序:0.18.0
- noestests:1.3.7
- 硒:3.8.0
在运行测试(大多数情况下会成功)时,我在geckodriver.log
输出消息中看到
When running the tests, which mostly succeed, I see in the geckodriver.log
output messages like
(firefox:55): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
/usr/bin/dbus-launch terminated abnormally without any error message
我的问题:
- 此消息是什么意思?
- 这是否表明有时测试失败的原因?
- 如果是,该如何解决?
推荐答案
您看到的错误是:
(firefox:55): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
/usr/bin/dbus-launch terminated abnormally without any error message
因此很明显, Firefox 尝试连接到 D-BUS守护程序,但由于 dbus-launch 被异常终止而失败.
So it is clear Firefox attempts to connect to D-BUS daemon and fails as dbus-launch gets terminated abnormally.
dbus-launch 基本上是实用程序,用于通过firefox通过shell脚本启动消息总线.通常会从用户的登录脚本中调用它. dbus-launch 启动会话总线实例,并将该实例的地址和pid
打印到标准输出.
dbus-launch is basically the utility to start a message bus by firefox through a shell script. It would normally be called from a user's login scripts. dbus-launch launches a session bus instance and print the address and pid
of that instance to standard output.
您可以从 Linux手册页
如果使用su
(根),sudo
,suedit
,gksu
,则可能会出现此错误.主要原因是DBUS_SESSION_BUS_ADDRESS
在您su
时保留其值,而不是在/root/.dbus/session-bus
中获取值.
This error can arise if you use su
(root), sudo
, suedit
, gksu
. The main reason is DBUS_SESSION_BUS_ADDRESS
retains its value when you su
instead of picking up the value in /root/.dbus/session-bus
.
在这里,您可以在.
另一个可能的原因可能是基本的Firefox
浏览器版本可能是较旧的版本,在该版本上进行了更新以达到当前版本.
Another possible reason may be the base Firefox
Browser version may be an older version on which updates were taken to reach the current version.
有几种解决方案可以解决 ubuntu 相关问题如下:
There are a couple of solutions available to address this ubuntu related issue as follows :
- 启动Firefox之前,您必须先输入
export $(dbus-launch)
- 但是,这可能会导致
NSS_USE_SHARED_DB
的另一个错误.因此,您也必须使用export NSS_USE_SHARED_DB=ENABLED
. -
最方便的方法是将所有配置都放在
.bashrc
文件中:
- Before you start Firefox you have to type
export $(dbus-launch)
- However this may result into another error with
NSS_USE_SHARED_DB
. So you have to useexport NSS_USE_SHARED_DB=ENABLED
as well. The most convenient way would be to put all the configuration with in
.bashrc
file :
export $(dbus-launch)
export NSS_USE_SHARED_DB=ENABLED
firefox &
此讨论详细讨论了该解决方案.
This discussion speaks about the solution in details.
- 如果未在系统上安装
dbus-launch
,则必须安装包含 dbus-launch 程序的dbus-x11
软件包. - 有效的解决方案是卸载旧版本的 Firefox 浏览器并安装最新发布的 Firefox 浏览器的 GA 版本.
- If
dbus-launch
is not installed on your system you have to installdbus-x11
package which contains the dbus-launch program. - An effective solution would be to uninstall the older base version of Firefox Browser and install a recent released GA version of Firefox Browser.
Ubuntu 和 Mozila 均已正确解决 dbus-launch 的问题.要克服此错误,您需要执行以下提到的步骤:
The issue with dbus-launch was addressed properly by both Ubuntu and Mozila. To overcome this error you need to follow the below mentioned steps :
- 保留您的 Ubuntu os 已更新为最新补丁程序和更新.
- 始终使用 Selenium-Python客户端,WebDriver 变体,例如 GeckoDriver 和网络浏览器,例如 Firefox浏览器. 在执行 Test之前和之后,通过 IDE 重新
- 清理并构建项目工作区 套房.
- 清除 浏览器缓存在执行测试之前和之后.
- 如果必须卸载任何 Web客户端变体(例如, Mozilla Firefox ),则可以使用 Revo Uninstallar 带有中等内存扫描的em>,以便废弃过时的注册表设置.
- 定期使用 CCleaner 工具清除 OS杂项,包括陈旧的.
- Keep your Ubuntu os updated with the Latest Patch Releases and updates.
- Always use the latest released version of Selenium-Python client, WebDriver variant e.g. GeckoDriver and Web Browser, e.g. Firefox Browser.
- Clean and Build the Project Workspace afresh through your IDE before and after executing your Test Suite.
- Clear the Browser Cache before and after the execution of your Tests.
- If you have to uninstall any of the Web Client variants (e.g. Mozilla Firefox) you can use Revo Uninstallar with Moderate Memory Scan so that the stale registry settings are discarded.
- Use CCleaner tool regularly to wipe away the OS chores including the stale rust_mozprofile directories.
这篇关于“客户端无法连接到D-BUS守护程序"的含义是什么?意思是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!