Skip to content
Advertisement

How to Validate Multiple screen using selenium with eclilpse?

I am new to selenium. I am validating two screens, Login and Password screens using selenium. The First screen is Login. If the username is correct then it will move to next screen that is Password. But in the Password screen the driver not putting the password into the input box, nothing is happening. It stops at Password screen. Any solution for that ? my code is below. It is working for Login screen.

  package Second;

  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.chrome.ChromeDriver;

  public class Second {

public static void main(String[] args) {
    System.setProperty("webdriver.chrome.driver", "E:\Installed 
   Application\chromedriver.exe");
    WebDriver driver = new ChromeDriver();
     driver.get("https://gamaa.ui.in/");
        driver.findElement(By.id("username")).sendKeys("test");
        driver.findElement(By.className("mat-primary")).click();
       
        driver.findElement(By.id("password")).sendKeys("1234");
        driver.findElement(By.className("mat-primary")).click();
}

}

Advertisement

Answer

It is taking time to load the next page element use WebDriverWait() and wait for elementToBeClickable()

 new WebDriverWait(driver, Duration.ofSeconds(10)).until(ExpectedConditions.elementToBeClickable(By.id("password"))).sendKeys("jaipur");
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement