Home > Software engineering >  How to Validate Multiple screen using selenium with eclilpse?
How to Validate Multiple screen using selenium with eclilpse?

Time:04-26

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

}

CodePudding user response:

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

CodePudding user response:

You can validate your progress and steps using the next page after passing (login page) so you can validate with the page title or element on the page with explicitly wait method

  • Related