2017-02-10 66 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