Here s the scenario:
Click on a Region--> select one country from the list --> Click one of the listed processes --> Browse the location of the input file --> upload and Execute the process.
It’s the basic flow for the remaining countries under a region and also for other 9 regions.
What I did was: Created a class for Regions (without main function), In this Code APAC and CANADA are regions.
public class Regions {
// For Clicking APAC
public static void APAC(WebDriver Driver)
{
WebElement APAC = Driver.findElement(By.xpath("//*[@id='APC']"));
APAC.click();
}
// For Clicking Canada
public static void Canada(WebDriver Driver)
{
WebElement Canada = Driver.findElement(By.xpath("//*[@id='CAN']"));
Canada.click();
}
Created a class for Processes (without main function), In here Paycost, Payroll are processes
public class Processes {
public void Paycost(WebDriver Driver)
{
WebElement Paycost = Driver.findElement(By.id("PaycostProcess"));
Paycost.click();
}
public void Miscellaneous_process(WebDriver Driver)
{
WebElement Miscellaneous = Driver.findElement(By.id("MiscellaneousProcess-V1"));
Miscellaneous.click();
}
Created a class for the remaining operations of browse upload execute (without main function),
public class Others{
public static void Upload(WebDriver Driver)
{
WebElement Upload = Driver.findElement(By.id("UploadButton"));
Upload.click();
}
// Clicking on the Execute button(13)
public static void Execute(WebDriver Driver)
{
//WebDriver Driver = InternetExplorerDriver();
WebElement Execute = Driver.findElement(By.id("Executing"));
Execute.click();
}
Now in a Class with Main function i am trying to call the methods from the 3 different class...
public class APAC_BU extends Others{
public static void main(String[] args) throws InterruptedException {
IE_Call(); // Calling from others class
WebDriver Driver = new InternetExplorerDriver();
Driver.get("");
Thread.sleep(5000);
APAC(Driver, "a4106"); // Calling from Regions Class
Thread.sleep(5000);
Country_Selection(Driver);
Paycost(Driver); // Calling from processes class
}
but i couldnt as its been stated that multiple inheritance is not possible in Java.. Can anyone help me in finding a solution to this problem.
I can bring up all the methods in single class itself but i find it little confusing while calling up the function.
I dono much in automation and Java. Please correct me if i am wrong.
I have an idea of creating an interface for each class like interface 1 for Class regions interface 2 for Class Processes and interface 3 for the others class.Grouping this interface together and then calling it from the main class.. This on calling it will get to grouped interface and calling the required method.
Its just my idea and i am not clear on the interface concept yet :( Kindly help on it
Thanks in Advance!!!!!