Skip to main content
1 of 3
jay
  • 13
  • 4
  • 10

Compilation error when extending class and defining a method

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.gmsr.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.deere.gmsr.utility.PageUtility;

public class LoginPage {

public LoginPage(WebDriver driver) {
    PageFactory.initElements(driver, this);
}

@FindBy(how = How.ID, using = PageUtility.OKTA_SIGNIN_USERNAME_ID)
@CacheLookup
public WebElement userNameTextField;

@FindBy(how = How.ID, using = PageUtility.OKTA_SIGNIN_PASSWORD_ID)
@CacheLookup
public WebElement passwordTextField;

@FindBy(how = How.ID, using = PageUtility.OKTA_SIGNIN_SUBMIT_ID)
@CacheLookup
public WebElement signInButton;

}

LoginBusiness:

package com.deere.gmsr.business;

import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.PageFactory;

import com.deere.gmsr.driver.Driver; import com.deere.gmsr.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("jb39359");
        passwordTextField.clear();
        passwordTextField.sendKeys("chinu174");
        signInButton.click();

}
    
}}
jay
  • 13
  • 4
  • 10