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

robot framework: org.openqa.selenium.NoSuchSessionException

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

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

我正在使用以下版本:

    <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 test(没有这个 jar 它正在工作)也给出了同样的异常。

问题是我在 1 个 maven 模块中使用了 Fitnesse、Cumber 和 Robot Framework。这是一个演示应用程序,用于展示这些框架如何适合我们的 jenkins 2 管道。 Fitnesse 和 Cucumber 使用的是 Selenium 3,robotframework-selenium2library-java 似乎不适用于 Selenium 3。因此存在冲突。

为了解决这个问题,我将每个测试框架放在一个单独的 maven 模块中,这将解决问题。也让我在未来的 selenium 版本上有更大的灵活性。