Tuesday, 15 April 2014

java - Catch NoSuch Element with log.error in webdriver? -


I added log4j (Apache software) as a logger in our webdeveloper test.

I wonder if logging terrorists should keep as a good practice in the capture block ?

Do we not want to use exceptions and objects and just work with E.PrintsStacksTrace ()?

Is it proper practice to add a log block?

  Public Static WebElement Destination Textbox (WebDdriver Driver) {try {element = driver.findElement (by ...); // It can not take exceptions if no element is found} // It will be caught here holding (KnowledgeElement exception E) {log. Terror ("No Element Found"); } // If the element is found and there is no exception, then just found 'element' log.info (found destination text box element);  

Why not? But it is better to provide a basic exception with the message, e.g. logs Terror ("message", e);


No comments:

Post a Comment