Java 在播放框架中使用cucumber和selenium webdriver时调试日志

Java 在播放框架中使用cucumber和selenium webdriver时调试日志,java,selenium,playframework,cucumber,Java,Selenium,Playframework,Cucumber,我一直在尝试将cumberjvm与seleniumwebdriver(firefox)集成在一起,但在我运行测试之后,现在我看到了很多可以调试selenium日志的东西 这是我目前的结构 添加了My build.sbt依赖项: "info.cukes" % "cucumber-java" % "1.2.4", "info.cukes" % "cucumber-junit" % "1.2.4", "info.cukes" % "cucumber-picocontainer" % "1

我一直在尝试将cumberjvm与seleniumwebdriver(firefox)集成在一起,但在我运行测试之后,现在我看到了很多可以调试selenium日志的东西

这是我目前的结构

添加了My build.sbt依赖项:

  "info.cukes" % "cucumber-java" % "1.2.4",
  "info.cukes" % "cucumber-junit" % "1.2.4",
  "info.cukes" % "cucumber-picocontainer" % "1.2.4",
  "org.seleniumhq.selenium" % "selenium-java" % "2.48.2"
软件部门:

Centos 6 64bit.
Firefox "Mozilla Firefox 31.3.0"
Java java version "1.8.0_45" (build 1.8.0_45-b13)
FirefoxDriver实例化:

@Before
public void setUp() throws Exception {
    if (driver == null) {
        driver = new FirefoxDriver();
        driver.navigate().to(base_url);
        driver.manage().deleteAllCookies();
   }
}
Junit Runner:

@RunWith(Cucumber.class)
@CucumberOptions(
    features="test/acceptance/features",
    glue={"context"},
    plugin={"html:cucumberReport"}
)
public class CucumberRunnerTest {
}
我如何运行测试:

./activator clean compile test
我得到的日志类型:

16:11:54.212 [Forwarding newSession on session null to remote] DEBUG o.a.h.c.protocol.RequestAddCookies - CookieSpec selected: default
16:11:54.213 [Forwarding newSession on session null to remote] DEBUG o.a.h.c.protocol.RequestAuthCache - Auth cache not set in the context
16:11:54.213 [Forwarding newSession on session null to remote] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection request: [route: {}->http://127.0.0.1:7056][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
16:11:54.213 [Forwarding newSession on session null to remote] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection leased: [id: 16][route: {}->http://127.0.0.1:7056][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000]
16:11:54.213 [Forwarding newSession on session null to remote] DEBUG o.a.h.impl.execchain.MainClientExec - Opening connection {}->http://127.0.0.1:7056
16:11:54.213 [Forwarding newSession on session null to remote] DEBUG o.a.h.i.c.DefaultHttpClientConnectionOperator - Connecting to /127.0.0.1:7056
16:11:54.214 [Forwarding newSession on session null to remote] DEBUG o.a.h.i.c.DefaultHttpClientConnectionOperator - Connection established 127.0.0.1:39264<->127.0.0.1:7056
16:11:54.214 [Forwarding newSession on session null to remote] DEBUG o.a.h.i.c.DefaultManagedHttpClientConnection - http-outgoing-16: set socket timeout to 10800000
16:11:54.214 [Forwarding newSession on session null to remote] DEBUG o.a.h.impl.execchain.MainClientExec - Executing request POST /hub/session HTTP/1.1
16:11:54.214 [Forwarding newSession on session null to remote] DEBUG o.a.h.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
16:11:54.214 [Forwarding newSession on session null to remote] DEBUG o.a.h.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 >> POST /hub/session HTTP/1.1
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 >> Content-Type: application/json; charset=utf-8
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 >> Content-Length: 105
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 >> Host: 127.0.0.1:7056
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 >> Connection: Keep-Alive
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 >> User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_45)
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 >> Accept-Encoding: gzip,deflate
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 >> "POST /hub/session HTTP/1.1[\r][\n]"
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 >> "Content-Type: application/json; charset=utf-8[\r][\n]"
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 >> "Content-Length: 105[\r][\n]"
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 >> "Host: 127.0.0.1:7056[\r][\n]"
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 >> "Connection: Keep-Alive[\r][\n]"
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 >> "User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_45)[\r][\n]"
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 >> "Accept-Encoding: gzip,deflate[\r][\n]"
16:11:54.215 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 >> "[\r][\n]"
16:11:54.216 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 >> "{"desiredCapabilities":{"browserName":"firefox","version":"","platform":"ANY"},"requiredCapabilities":{}}"
16:11:54.307 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 << "HTTP/1.1 200 OK[\r][\n]"
16:11:54.307 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 << "content-type: application/json; charset=UTF-8[\r][\n]"
16:11:54.307 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 << "connection: close[\r][\n]"
16:11:54.308 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 << "content-length: 421[\r][\n]"
16:11:54.308 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 << "server: httpd.js[\r][\n]"
16:11:54.308 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 << "date: Thu, 10 Dec 2015 16:11:54 GMT[\r][\n]"
16:11:54.308 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 << "[\r][\n]"
16:11:54.308 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 << HTTP/1.1 200 OK
16:11:54.308 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 << content-type: application/json; charset=UTF-8
16:11:54.308 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 << connection: close
16:11:54.308 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 << content-length: 421
16:11:54.308 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 << server: httpd.js
16:11:54.308 [Forwarding newSession on session null to remote] DEBUG org.apache.http.headers - http-outgoing-16 << date: Thu, 10 Dec 2015 16:11:54 GMT
16:11:54.310 [Forwarding newSession on session null to remote] DEBUG org.apache.http.wire - http-outgoing-16 << "{"name":"newSession","sessionId":"d1aa222a-0c82-46a6-a0dd-80942dc13274","status":0,"value":{"cssSelectorsEnabled":true,"browserName":"firefox","handlesAlerts":true,"javascriptEnabled":true,"nativeEvents":false,"platform":"Linux","rotatable":false,"takesScreenshot":true,"version":"31.3.0","webStorageEnabled":true,"applicationCacheEnabled":true,"databaseEnabled":true,"locationContextEnabled":true,"acceptSslCerts":true}}"
16:11:54.310 [Forwarding newSession on session null to remote] DEBUG o.a.h.i.c.DefaultManagedHttpClientConnection - http-outgoing-16: Close connection
16:11:54.310 [Forwarding newSession on session null to remote] DEBUG o.a.h.impl.execchain.MainClientExec - Connection discarded
16:11:54.310 [Forwarding newSession on session null to remote] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection released: [id: 16][route: {}->http://127.0.0.1:7056][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
16:11:54.212[将会话空时的新闻会话转发到远程]调试o.a.h.c.protocol.RequestAddCookies-CookieSpec已选择:默认值
16:11:54.213[将会话null上的新闻会话转发到远程]调试o.a.h.c.protocol.RequestAuthCache-未在上下文中设置Auth cache
16:11:54.213[将会话null上的新闻会话转发到远程]调试o.a.h.i.c.PoollightTPClientConnectionManager-连接请求:[路由:{}->http://127.0.0.1:7056][保持活动状态的总数:0;分配的路由:2000年的0;分配的总数:2000年的0]
16:11:54.213[将会话null上的新闻会话转发到远程]调试o.a.h.i.c.PoolighttpClientConnectionManager-已租用连接:[id:16][路由:{}->http://127.0.0.1:7056][保持活动状态的总数:0;分配的路线:2000年第1条;分配的总数:2000年第1条]
16:11:54.213[将会话null上的新闻会话转发到远程]调试o.a.h.impl.execchain.MainClientExec-打开连接{}->http://127.0.0.1:7056
16:11:54.213[将会话null上的新闻会话转发到远程]调试o.a.h.i.c.DefaultHttpClientConnectionOperator-连接到/127.0.0.1:7056
16:11:54.214[将会话null上的新闻会话转发到远程]调试o.a.h.i.c.DefaultHttpClientConnectionOperator-已建立连接127.0.0.1:39264127.0.0.1:7056
16:11:54.214[将会话null上的新闻会话转发到远程]调试o.a.h.i.c.DefaultManagedHttpClient连接-http-outgoing-16:将套接字超时设置为10800000
16:11:54.214[将会话null上的新闻会话转发到远程]调试o.a.h.impl.execchain.MainClientExec-执行请求POST/hub/session HTTP/1.1
16:11:54.214[将会话null上的新闻会话转发到远程]调试o.a.h.impl.execchain.MainClientExec-目标身份验证状态:未被质询
16:11:54.214[将会话null上的新闻会话转发到远程]调试o.a.h.impl.execchain.MainClientExec-代理身份验证状态:未被质询
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.headers-http-outing-16>>POST/hub/session http/1.1
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.headers-http-outing-16>>内容类型:application/json;字符集=utf-8
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.headers-http-outing-16>>内容长度:105
16:11:54.215[将会话null上的新闻会话转发到远程]调试org.apache.http.headers-http-outing-16>>主机:127.0.0.1:7056
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.headers-http-outing-16>>连接:保持活动状态
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.headers-http-outing-16>>用户代理:apache HttpClient/4.5.1(Java/1.8.045)
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.headers-http-outing-16>>接受编码:gzip,deflate
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.wire-http-outing-16>>“POST/hub/session http/1.1[\r][\n]”
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.wire-http-outing-16>>“内容类型:application/json;charset=utf-8[\r][\n]”
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.wire-http-outing-16>>“内容长度:105[\r][\n]”
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.wire-http-outgoing-16>>“主机:127.0.0.1:7056[\r][\n]”
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.wire-http-outing-16>>“连接:保持活动[\r][\n]”
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.wire-http-outing-16>>“用户代理:apache HttpClient/4.5.1(Java/1.8.0_45)[\r][\n]”
16:11:54.215[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.wire-http-outing-16>>“接受编码:gzip,deflate[\r][\n]”
16:11:54.215[将会话null上的新闻会话转发到远程]调试org.apache.http.wire-http-outing-16>“[\r][\n]”
16:11:54.216[将会话null上的新闻会话转发到远程]DEBUG org.apache.http.wire-http-outing-16>“{”desiredCapabilities:{”browserName:“firefox”,“version:“,”platform:“ANY”},“requiredCapabilities:{}”

16:11:54.307[Forwarding newSession on session null to remote]DEBUG org.apache.http.wire-http-outgoing-16对于我的带有cucumber和webdriver的Maven项目,解决方案是向“/resources/logback.xml”添加一个文件,内容如下所示

因此,它应该能够对playframework执行相同的操作。创建一个“conf/resources/logback.xml”,内容如下:

<configuration debug="false">
  <!-- definition of appender STDOUT -->
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
    </encoder>
  </appender>

  <root level="ERROR">
    <!-- appender referenced after it is defined -->
    <appender-ref ref="STDOUT"/>
  </root> 
</configuration>


)

环境的可能副本非常不同,他甚至没有使用cucumber jvm(java)。没有,但答案实际上是关于配置cucumber。如果我理解正确,答案实际上是关闭soap客户端(Savon)。我正在尝试解决同样的问题。我试着设置webdriver的日志记录级别,就像在这里:在这里,但这似乎不是这些日志记录的根源。