机器人框架:org.openqa.selenium.NoSuchSessionException

时间:2017-06-09 18:20:03

标签: selenium testing automated-tests robotframework fitnesse

我试图让我的第一个机器人测试运行,但无论我尝试什么,我都会遇到以下异常:

org.openqa.selenium.NoSuchSessionException

我的测试看起来像

*** Settings ***
Documentation  A resource file containing the application specific keywords
Library     Selenium2Library

*** Test Cases ***
Check out www google dot com
    Open Browser  https://www.google.com  htmlunit
    Close Browser

enter image description here

我使用以下版本:

    <version.robot>3.0.2</version.robot>
    <version.robot.maven.plugin>1.4.7</version.robot.maven.plugin>
    <version.selenium2library>1.4.0.8</version.selenium2library>

由以下jar中的内容引起。

<dependency>
            <groupId>com.github.markusbernhardt</groupId>
            <artifactId>robotframework-selenium2library-java</artifactId>
            <version>${version.selenium2library}</version>
            <scope>test</scope>
        </dependency>

当我添加这个依赖项时,fitnesse测试(没有这个jar它正在工作)会给出相同的异常。

1 个答案:

答案 0 :(得分:0)

问题是我在1个maven模块中使用了Fitnesse,Cumber和Robot Framework。这是一个演示应用程序,以显示这些framworks如何适合我们的jenkins 2管道。 Fitnesse和Cucumber正在使用Selenium 3,而robotframework-selenium2library-java似乎与Selenium 3无关。所以存在冲突。

为了解决这个问题,我将每个测试框架放在一个单独的maven模块中,以解决问题。同时为我提供更多的硒版本灵活性。