Error- POM-PAgefactory -Module -40 | Selenium Forum
M
Posted on 11/02/2016
hi,

I'm practicing on POM- Page factory module-40 .While excuting testlogin.java file giving error.

[code:14qi13mo]package practicepurpose.businessclass;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.PageFactory;
import com.facebook.pages.Loginpage;
public class testlogin {

public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver= new FirefoxDriver();
Loginpage lp= PageFactory.initElements(driver, Loginpage.class);

lp.login("mmmm","mmmm");

}

}

package com.facebook.pages;

import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class Loginpage {
public WebDriver driver;

@FindBy(xpath=".//*[@id='email']")
public WebElement username;

@FindBy(xpath=".//*[@id='pass']")
public WebElement password;

@FindBy(xpath=".//*[@id='u_0_l']")
public WebElement loginbtn;

public Loginpage(WebDriver dr ){
driver = dr;

}

public void login(String uname,String pwd){
driver.get("http://facebook.com");
username.sendKeys("uname");
password.sendKeys("pwd");
loginbtn.sendKeys(Keys.ENTER);
}

}








[/code:14qi13mo]


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.

M
Replied on 11/02/2016

problem is not with selenium or POM but with log4j.

you have to initialized it correctly.

watch the log4j video again.