I am a complete newbie in Selenium and java in general. I am trying to use the Page object model with Page factory to create Page object class for the Login page of an application. When I create a method the WebElement object errors indicating the follwoing: error message . I have seen other demonstrations where the webelements do not have to be static. I don't know what I can be doing wrong.
package com.imis.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import Actiondriver.ImisActionclass;
import Base.basepackage;
public class login extends basepackage {
@FindBy(xpath="//input[@id='ctl01_TemplateBody_WebPartManager1_gwpciSignIn_ciSignIn_signInUserName']")
WebElement userName;
@FindBy(xpath="//input[@id='ctl01_TemplateBody_WebPartManager1_gwpciSignIn_ciSignIn_signInPassword']")
WebElement password;
@FindBy(xpath="//input[@id='ctl01_TemplateBody_WebPartManager1_gwpciSignIn_ciSignIn_SubmitButton']")
WebElement submitButton;
public login() {
PageFactory.initElements(driver, this);
}
public static void loginpage(String uname, String pswd) {
ImisActionclass.type(userName, text);
ImisActionclass.type(pswd, password);
ImisActionclass.click(driver, submitButton);