【问题标题】:selenium automation test in Linux problem: firefox can't be closed automaticallyLinux下selenium自动化测试问题:firefox不能自动​​关闭
【发布时间】:2011-05-19 14:05:27
【问题描述】:

我正在通过 selenium (selenium RC) 在 Linux 中运行 Web GUI 的自动化测试。事实上,我可以在windows中运行selenium自动化测试,结果很好,测试完成后firefox可以自动关闭。 但是当我在linux中进行selenium测试时,我发现测试完成后firefox无法自动关闭。 我知道测试脚本默认会调用tearDown函数,所以应该关闭firefox。但是为什么在Linux下,firefox不能自动​​关机呢?

解决这个问题: 我重写了如下的 tearDown 函数:

public void tearDown() throws Exception
    {
        selenium.click("link=Logout");
        super.tearDown();
    }

但是在Linux下,firefox还是无法关闭。
谁能帮我解决这个问题?测试完成后如何让Firefox自行关闭? P.S:到目前为止,我还没有找到关闭firefox的方法,顺便说一下,我使用参数-firefoxProfileTemplate来启动selenium-server.jar,因为我的web GUI是https。

【问题讨论】:

    标签: linux firefox selenium solaris selenium-rc


    【解决方案1】:

    问题解决了:那是因为我的 firefox。 这是因为 Selenium 想要直接启动 FireFox 二进制文件,而不是委托给正常的启动脚本。在检查“firefox”(这是许多安装中的脚本)之前,它会检查“firefox-bin”。 但是我将我的 Firefox 设置为由 firefox 而不是由 firefox-bin 启动。 更多细节可以在以下位置找到: Selenium not working with Firefox 3.x on linux

    【讨论】:

      【解决方案2】:

      调用stop() 函数应该关闭浏览器。如果不是,请检查启动服务器时是否使用-browserSessionReuse

      【讨论】:

      • 很糟糕,我尝试了stop()方法,但似乎仍然无法关闭firefox。我没有使用-browserSessionReuse,但是我使用了-firefoxProfileTemplate,是不是firefoxProfileTemplate引起的?但其实在windows下,firefox可以很好的关闭。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-29
      • 2011-05-06
      • 2011-07-21
      • 2013-12-24
      • 2020-12-31
      • 1970-01-01
      • 2014-09-06
      相关资源
      最近更新 更多