Skip to main content
Code edited
Source Link
jay
  • 13
  • 4
  • 10

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.gmsrpages.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_IDSIGNIN_USERNAME_ID)
    @CacheLookup
    public WebElement userNameTextField;

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

    @FindBy(how = How.ID, using = PageUtility.OKTA_SIGNIN_SUBMIT_IDSIGNIN_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""aaaa");
            passwordTextField.clear();
            passwordTextField.sendKeys("chinu174""4444");
            signInButton.click();

    }
        
    }}
    

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();

    }
        
    }}
    

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();

    }
        
    }}
    

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 {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;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();

    }
        
    }}
    

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();

}
    
}}

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();

    }
        
    }}
    
Source Link
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();

}
    
}}