0

我是 Selenide 的新手,并尝试使用 Selenide 和 Junit 依赖项运行浏览器。但是,我得到一个

SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”错误。有什么想法吗?

xmlns="http://maven.apache.org/POM/4.0.0"

     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>1</groupId>
<artifactId>1</artifactId>
<version>1.0-SNAPSHOT</version>

<!-- https://mvnrepository.com/artifact/com.codeborne/selenide -->
<dependencies>
<dependency>
    <groupId>com.codeborne</groupId>
    <artifactId>selenide</artifactId>
    <version>4.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-nop -->

import com.codeborne.selenide.Configuration;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static com.codeborne.selenide.Selenide.close;
import static com.codeborne.selenide.Selenide.open;

public class ChromeStart {
    @Before
    public void RunURL() {
        Configuration.browser= "chrome";
        open ("http://google.com");
    }
    @Test
    public void StartBrowser() {
        System.out.println("Hello world")
    }
    @After
    public void CloseURL(){
        close();
    }
}
4

1 回答 1

3

此错误很可能是缺少依赖项的结果。尝试将以下依赖项添加到您的 pom.xml 文件并再次运行您的测试。

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4jnop</artifactId>
  <version>1.7.21</version>
</dependency>
于 2016-12-14T21:03:36.303 回答