I'm going to be starting a new role soon as a Software QA Analyst and I'm trying to practice my automated testing by developing some basic automated test scripts using Java and Selenium WebDriver. I'm very new to automation and Java in general so I wanted to practice using a popular travel website's form as a basis. The script needs to allow for inputting data that's been prepared beforehand in an Excel spreadsheet, capture certain results on the site based off of the input data, and then export those results to the appropriate cell in that same Excel spreadsheet. I've actually created a script that seems to do this fairly well, however every time I run the script, I get an error message that reads:
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.
The rest of the script seems to go off pretty smoothly but I'm really not sure what this error is referring to or how to fix it. I went to the URL that it listed but that was like reading a completely foreign language. I've been googling a lot but I have yet to find anything that addresses my specific instance of this error message and I was hoping someone might be able to help me. Most of the script has been assembled by examples I've found online in one form or another and I've assembled it to generally do what I want from it. I'm not sure if this is relevant or not but I have the project loaded with all of the latest versions of the Selenium WebDriver, Apache POI, and Junit, external JAR files. I'm really new to Java, Selenium WebDriver, and automation in general so if anyone has a solution, especially the "why" behind this error, that would be much appreciated. My entire code is below.
package TestCases;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.concurrent.TimeUnit;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class OrbitzDotComBasicFormEntry1 {
public static void main(String[] args) throws Exception {
WebDriver wd = new FirefoxDriver();
String baseURL = "http://www.orbitz.com/";
wd.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
InputStream inp = new FileInputStream("/path/to/spreadsheet/Workbook1.xlsx");
Workbook wb = WorkbookFactory.create(inp);
Sheet sheet = wb.getSheetAt(0);
String departLocation;
String arriveLocation;
String departureDate;
String returnDate;
int rowcount=sheet.getLastRowNum();
for(int i=1;i<=rowcount;i++){
Row row = sheet.getRow(i);
Cell cell = row.getCell(4);
departLocation=sheet.getRow(i).getCell(0).getStringCellValue();
arriveLocation=sheet.getRow(i).getCell(1).getStringCellValue();
departureDate=sheet.getRow(i).getCell(2).getStringCellValue();
returnDate=sheet.getRow(i).getCell(3).getStringCellValue();
wd.get(baseURL);
//Selects the "Flights Only" radio button
wd.findElement(By.id("search.type.air")).click();
Thread.sleep(1000);
//Enter variable text into the "From" field
wd.findElement(By.name("ar.rt.leaveSlice.orig.key")).click();
wd.findElement(By.name("ar.rt.leaveSlice.orig.key")).clear();
wd.findElement(By.name("ar.rt.leaveSlice.orig.key")).sendKeys(departLocation);
//Enter variable text into the "To" field
wd.findElement(By.name("ar.rt.leaveSlice.dest.key")).click();
wd.findElement(By.name("ar.rt.leaveSlice.dest.key")).clear();
wd.findElement(By.name("ar.rt.leaveSlice.dest.key")).sendKeys(arriveLocation);
//Enter variable text into the "Leave" field
wd.findElement(By.name("ar.rt.leaveSlice.date")).click();
wd.findElement(By.name("ar.rt.leaveSlice.date")).clear();
wd.findElement(By.name("ar.rt.leaveSlice.date")).sendKeys(departureDate);
Thread.sleep(1000);
//Enter variable text into the "Return" field
wd.findElement(By.name("ar.rt.returnSlice.date")).click();
wd.findElement(By.name("ar.rt.returnSlice.date")).clear();
wd.findElement(By.name("ar.rt.returnSlice.date")).sendKeys(returnDate);
Thread.sleep(1000);
//Clicks the "Search Flights" button
wd.findElement(By.name("search")).click();
Thread.sleep(30000);
String bestPrice = wd.findElement(By.cssSelector(".money.small-cents.small-symbol")).getText();
if (cell == null)
cell = row.createCell(4);
cell.setCellType(Cell.CELL_TYPE_STRING);
cell.setCellValue(bestPrice);
FileOutputStream fileOut = new FileOutputStream("/path/to/spreadsheet/Workbook1.xlsx");
wb.write(fileOut);
fileOut.close();
}
wd.close();
System.out.println("The Class script has finished running");
}
}