I am getting compilation error when I am extending Loginpage class through Loginbusiness, define a method but compilation throws an error to remove illegal identifiers(eg. public) and also for arguments passed to that methods:
Login Page:
package com.pages.page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;
import com.utility.PageUtility;
public class LoginPage {
public LoginPage(WebDriver driver) {
PageFactory.initElements(driver, this);
}
@FindBy(how = How.ID, using = PageUtility.SIGNIN_USERNAME_ID)
@CacheLookup
public WebElement userNameTextField;
@FindBy(how = How.ID, using = PageUtility.SIGNIN_PASSWORD_ID)
@CacheLookup
public WebElement passwordTextField;
@FindBy(how = How.ID, using = PageUtility.SIGNIN_SUBMIT_ID)
@CacheLookup
public WebElement signInButton;
}
LoginBusiness:
package com.business;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.PageFactory;
import com.driver.Driver;
import com.page.LoginPage;
public class LoginBusiness extends LoginPage {
public LoginPage loginpage;
public LoginBusiness(WebDriver driver) {
super(driver);
// TODO Auto-generated constructor stub
// loginpage = PageFactory.initElements(Driver.getDriver(), LoginPage.class);
WebElement loginToApplication(String username String password) {
userNameTextField.clear();
userNameTextField.sendKeys("aaaa");
passwordTextField.clear();
passwordTextField.sendKeys("4444");
signInButton.click();
}
}}