我在java應用程序中使用selenium-server和phantomjsdriver。Selenium Webdriver Logging
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.44.0</version>
</dependency>
<dependency>
<groupId>com.github.detro.ghostdriver</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
</dependency>
這會產生我的控制檯
- org.slf4j.Logger應用程序日誌上的3種不同的輸出,沒有日誌設置尚未
- 硒的webdriver記錄
- phantomJS輸出?
現在的問題是
- 怎樣使硒日誌SLF4J? (或任何其他記錄器)
- 使用相同格式的所有消息
- 是否可以將phantomJS/Selenium日誌寫入單獨的文件?下面
2232 [pool-1-thread-1] INFO com.opendi.util.selenium.service.PhantomJsService - New PhantomJS instance Oct 07, 2015 10:14:50 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> INFO: executable: /home/michel/github/work/screencapture/bin/amd64/phantomjs Oct 07, 2015 10:14:50 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> INFO: port: 11710 Oct 07, 2015 10:14:50 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> INFO: arguments: [--webdriver=11710] 2306 [pool-1-thread-2] INFO com.opendi.util.selenium.service.PhantomJsService - New PhantomJS instance Oct 07, 2015 10:14:50 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> INFO: executable: /home/michel/github/work/screencapture/bin/amd64/phantomjs Oct 07, 2015 10:14:50 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> INFO: port: 18873 Oct 07, 2015 10:14:50 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> INFO: arguments: [--webdriver=18873] Oct 07, 2015 10:14:50 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> INFO: environment: {} Oct 07, 2015 10:14:50 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> INFO: environment: {} [INFO - 2015-10-07T08:14:50.392Z] GhostDriver - Main - running on port 18873 [INFO - 2015-10-07T08:14:50.421Z] GhostDriver - Main - running on port 11710
示例輸出一些幫助,將不勝感激