我在 WebDriverManager 中使用下面的代码-
package MySelenium.mySelenium;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class TestSelenium {
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
driver.get("https://www.demoqa.com");
driver.quit();
}
}
当我运行我的程序时收到以下消息,尽管它不会影响我的执行。它运行成功,但带有此消息-
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 89.0.4389.23
我搜索了堆栈溢出,发现如果我在 POM.xml 中添加以下两个 jar,错误将被删除,所以我添加了这两个 jar,但现在开始收到不同的消息-
<artifactId>slf4j-log4j12</artifactId>
<artifactId>slf4j-api</artifactId>
消息现在得到-
log4j:WARN No appenders could be found for logger (io.github.bonigarcia.wdm.cache.ResolutionCache).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Starting ChromeDriver 89.0.4389.23
请帮助删除这些消息