使用GeckoDriver和Firefox通过Selenium和Java进行的此会话警告将忽略Marionette-WARN-TLS证书错误

问题描述 投票:0回答:1

是Selenium WebDriver的初学者。我编写了一个代码,仅浏览到URL并登录到该URL。另外要在控制台中显示消息,字符串URL是否正确为当前URL。该代码成功执行,并按预期工作。它已登录。但是同时在控制台中出现了一些警告消息。有人可以让我知道警告消息的原因吗?是否因为缺少任何jar文件?我正在使用最新版本的JDK和Selenium WebDriver。请参见下面的代码段和控制台错误。

代码如下:

    package testSelenium1;  
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;      
    import org.openqa.selenium.firefox.FirefoxDriver;
    public class admin {
    public static void main(String args[]) {  
	System.setProperty("webdriver.gecko.driver","C:\\Users\\30211170\\Downloads\\geckodriver-v0.26.0-win64\\geckodriver.exe");
    WebDriver driver = new FirefoxDriver();// Launches firefox browser with blank URL
    driver.get("http://www.gcrit.com/build3/admin/login.php?");
    driver.findElement(By.name("username")).sendKeys("admin"); 
    driver.findElement(By.name("password")).sendKeys("admin@123");
    driver.findElement(By.id("tdb1")).click();
	String url = driver.getCurrentUrl();
	if (url.equals("http://www.gcrit.com/build3/admin/index.php")) {
	System.out.println("Login is success");
	} else {
	System.out.println("Log in failed");
	} 
	}
}

警告消息如下:

1576773751789	mozrunner::runner	INFO	Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\30211170\\AppData\\Local\\Temp\\rust_mozprofile69gY6Q"
1576773753129	[email protected]	WARN	Loading extension '[email protected]': Reading manifest: Invalid extension permission: mozillaAddons
1576773753129	[email protected]	WARN	Loading extension '[email protected]': Reading manifest: Invalid extension permission: telemetry
1576773753130	[email protected]	WARN	Loading extension '[email protected]': Reading manifest: Invalid extension permission: resource://pdf.js/
1576773753130	[email protected]	WARN	Loading extension '[email protected]': Reading manifest: Invalid extension permission: about:reader*
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
1576773756768	Marionette	INFO	Listening on port 64629
1576773757219	Marionette	WARN	TLS certificate errors will be ignored for this session
Dec 19, 2019 10:12:37 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Login is success
java selenium firefox marionette geckodriver
1个回答
0
投票

此警告消息...

1576850500604   Marionette  WARN    TLS certificate errors will be ignored for this session

...表示Marionette将忽略此会话的TLS证书错误。

警告是在Selenium使用发起新的Browsing Context,即Firefox Browser会话时生成的。


结论

WARNING消息对您的@ Tests无害,您可以安全地忽略它。

© www.soinside.com 2019 - 2024. All rights reserved.