I want to validate the Text message displayed on the Bounce toast. I have tried many things link implicit wait and others. Can anyone suggest how to do it?
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
WebElement userInfo Element = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("/html/body/div/div[3]/div/div/div[1]/div[2]")));
String userInfoText = userInfoElement.getText();
Assert.assertTrue(userInfoText.contains("Login successfully."));
Validating the text in automated testing.
developer tools source
You need to use the developer tools source menu to capture toast messages or other lost messages. After stopping here, you can locate the element and do necessary waiting and synchronisation issues.