I am running the following data driven testing code but getting the following error:
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Can anyone help me out in resolving this issue
import java.io.File;
import java.io.FileInputStream;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class DataDriven_Ex {
static WebElement searchbox;
public static void main(String[] args) {
FirefoxDriver driver = new FirefoxDriver();
driver.get("http://www.amazon.in");
WebElement searchbox = driver.findElement(By.xpath("//*[@id='twotabsearchtextbox']"));
}
@Test
public void test() throws Exception {
File file = new File("F://Selenium excel//DataDriven.xlsx");
FileInputStream fs = new FileInputStream(file);
XSSFWorkbook wb = new XSSFWorkbook(fs);
XSSFSheet sh = wb.getSheet("Sheet1");
int rowcount = sh.getLastRowNum();
for (int i = 0; i<=rowcount;i++)
{
String keyword = sh.getRow(i).getCell(0).getStringCellValue();
searchbox.sendKeys(keyword);
searchbox.submit();
}
}
}
As it is mentioned in the warning message, you should see full explanation at http://logging.apache.org/log4j/1.2/faq.html#noconfig . You have to check if you supply a log4j.properties
or log4j.xml
as part of the runtime classpath (ie that is accessible from Classloader at runtime).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.