没有为logger找到appender(org.apache.http.client.protocol.RequestAddCookies) [英] No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies)

查看:569
本文介绍了没有为logger找到appender(org.apache.http.client.protocol.RequestAddCookies)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Firefoxdriver上运行selenium webdriver代码但是在运行时我得到一个异常 -

I am trying to run a selenium webdriver code on Firefoxdriver but at the run time i am getting an exception --

log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 15 milliseconds
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30'
System info: host: 'Admin-PC', ip: '192.168.2.5', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_65'
Session ID: 826ebd51-0bc9-4900-b0ef-d68279bd19fe
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, databaseEnabled=true, cssSelectorsEnabled=true,javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, webStorageEnabled=true, nativeEvents=false, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=31.0}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:79)
at ResumeUpdate.Screen_1_Monster.operation(Screen_1_Monster.java:20)
at ResumeUpdate.Screen_1_Monster.main(Screen_1_Monster.java:47)
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Element is not currently visible and so may not be interacted with
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30'
System info: host: 'Admin-PC', ip: '192.168.2.5', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_65'
Driver info: driver.version: unknown
at <anonymous class>.fxdriver.preconditions.visible(file:///C:/Users/Admin/AppData/Local/Temp/anonymous2662838285289924370webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:8791:5)
at <anonymous class>.DelayedCommand.prototype.checkPreconditions_(file:///C:/Users/Admin/AppData/Local/Temp/anonymous2662838285289924370webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:11438:1)
at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/Admin/AppData/Local/Temp/anonymous2662838285289924370webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:11455:11)
at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/Users/Admin/AppData/Local/Temp/anonymous2662838285289924370webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:11460:7)
at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/Users/Admin/AppData/Local/Temp/anonymous2662838285289924370webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:11402:5)

代码为 -
import org.openqa.selenium。*;
import org.openqa.selenium.firefox.FirefoxDriver;

The code is - import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver;

public class Screen_1_Monster {

WebDriver driver;
WebElement wb;
public void operation() throws InterruptedException{
   driver = new FirefoxDriver();
  //going to the desired website
  driver.get("https://login.naukri.com/nLogin/Login.php?URL=http%3A%2F%2Fmy.naukri.com%2FMailers%2Fshowdnc%2F%3Furl%3Dhttp%3A%2F%2Fmy.naukri.com%2FHomePage%2Fview%3Fid%3D6e346be1ad03f4d67d75e5911b88ec3df281f50b07bbd08fb4c7f074e87577b79a86cc384cde9c370d99ad6a3af22255");

  //User id 
  wb = driver.findElement(By.id("emailTxt"));
  wb.click();
  wb.sendKeys("an@gmail.com");

  //Password
  wb=driver.findElement(By.id("pwd1"));
  wb.click();
  wb.sendKeys("2738");

  //Login Button
  driver.findElement(By.id("sbtLog")).click();
  Thread.sleep(20000);
  //if Usename/Password is incorrect
  wb=driver.findElement(By.id("srvErr"));
  String error=wb.getText();
  String e=wb.getAttribute("value");
  System.out.println(error +"  "+ e);
  //Get status of Welcome page
  String title=driver.getTitle();
  System.out.println(title);
}//operation

 public static void main(String args[]) throws InterruptedException{
   Screen_1_Monster s = new Screen_1_Monster();
   s.operation();
 }
}//Scrren_1_Monster


推荐答案

事实上,您获得的例外与您在帖子标题中提到的警告无关。

Infact, the exception you're getting has nothing to do with the warning you mention in your post title.

警告:它是只告诉您没有定义任何appender(有关详细信息,请参阅 log4j文档) )为硒司机。所以基本上,他不能记录你告诉它的地方(因为你没有告诉他在哪里)。

The warning : it's only telling you that you did not define any appender (see log4j documentation for more information) for the selenium driver. So basically, he can't log where you told it to (because you didn't tell him where).

异常:你告诉(在你的测试用例中)selenium驱动程序与网页中的元素进行交互。驱动程序没有找到这个元素,所以他无法与它进行交互。

The exception : you told (in your test case) the selenium driver to interact with an element in the web page. The driver didn't find this element, so he can't interact with it.

如果您想要查找更多信息的异常,请查找元素不是目前可见,因此可能无法与而不是log4j警告交互:

If you want to google your exception for more infos, look for "Element is not currently visible and so may not be interacted with" instead of the log4j warning :)

这篇关于没有为logger找到appender(org.apache.http.client.protocol.RequestAddCookies)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆