2017-02-10 63 views
0

当我尝试此代码但测试用例执行成功时,我收到警告讯息。Selenium - Firefox - Java - Gecko - 警告讯息

代码

package test; 

import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.firefox.FirefoxDriver; 

public class teatcalss { 

public static void main(String[] args) { 
    // declaration and instantiation of objects/variables 
     System.setProperty("webdriver.gecko.driver", "D:\\java\\geckodriver-v0.14.0-win64\\geckodriver.exe"); 

    WebDriver driver = new FirefoxDriver(); 
    String baseUrl = "http://newtours.demoaut.com"; 
    String expectedTitle = "Welcome: Mercury Tours"; 
    String actualTitle = ""; 

    // launch Firefox and direct it to the Base URL 
    driver.get(baseUrl); 

    // get the actual value of the title 
    actualTitle = driver.getTitle(); 

    /* 
    * compare the actual title of the page witht the expected one and print 
    * the result as "Passed" or "Failed" 
    */ 
    if (actualTitle.contentEquals(expectedTitle)){ 
     System.out.println("Test Passed!"); 
    } else { 
     System.out.println("Test Failed"); 
    } 

    //close Firefox 
    driver.close(); 

    // exit the program explicitly 
    System.exit(0); 
} 
} 

警告消息

1486664295999 geckodriver信息上侦听127.0.0.1:44072 2017年2月9日上午10时18分十六秒org.openqa.selenium.remote。 ProtocolHandshake createSession INFO:尝试双方言会话,假设Postel法则在远程端为真 log4j:WARN无法找到记录器(org.apache.http.client.protocol.RequestAddCookies)的appender。 log4j:WARN请正确初始化log4j系统。 log4j:WARN有关更多信息,请参阅http://logging.apache.org/log4j/1.2/faq.html#noconfig。 1486664297761 mozprofile :: profile INFO使用配置文件路径C:\ Users \ Radwa \ AppData \ Local \ Temp \ rust_mozprofile.DhhwmmiiHibT 1486664297779 geckodriver :: marionette信息启动浏览器C:\ Program Files(x86)\ Mozilla Firefox \ firefox.exe 1486664297822 geckodriver ::木偶信息连接到木偶在localhost:10262 [GFX1-]:CreateShaderResourceView失败format87 1486664301804木偶信息侦听端口10262 [GFX1-]:CreateShaderResourceView失败format87 2017年2月9日10:18 :29 AM org.openqa.selenium.remote.ProtocolHandshake createSession 信息:检测到的方言:W3C 测试通过!

+0

你的问题是什么? –

回答

0

这是已知的信息。有关更多信息和讨论,请参阅here。底线,这不是一个错误,它不会破坏任何东西。如果有事情搞砸了,那么现在是时候进行调查了。现在,您可以放心地忽略它。

0

您可以使用下面的代码用脚本,这将重定向这些低级别的日志到一个单独的文件,而不是控制台 -

System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE,"true"); 
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,"C:\\temp\\logs.txt"); 

欲了解更多信息,请查看参考这篇文章 - Disable Firefox logs