Home > Net >  Is there a way to write a function to call multiple times in java selenium webdriver
Is there a way to write a function to call multiple times in java selenium webdriver

Time:09-20

@Test(priority = 0)
public void platformAdminLogin() {
    // login as platform admin with correct credentials
    try {
        driver.findElement(By.id("emailId")).sendKeys("[email protected]");
        driver.findElement(By.id("password")).sendKeys("Test@123");
        driver.findElement(By.className("loginButton")).click();
        System.out.println("Sucessful login as Platform admin");
        //Logout
        Thread.sleep(500);
        driver.findElement(By.id("headerIconLogout")).click();
        driver.findElement(By.id("logOutYesIcon")).click();
    } catch (Exception e) {
        System.out.println("Error while login as Platform admin = "   e);
    }

How to write a function for logout and how to call multiple times

CodePudding user response:

You can call your function using any iterator such as while or for loops and set your calling limit.

CodePudding user response:

You can call your function with a time duration using the java scheduler schedulers-in-java

  • Related