Hey Priyank, to understand how assertFalse() or assertTrue() works, please refer to the following code snippet:
package co.edureka.selenium.assertions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
public class AssertTrueFalse {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\\\Users\\\\Abha_Rathour\\\\Downloads\\\\ExtractedFiles\\\\chromedriver_win32\\\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.navigate().to("https://www.spicejet.com/");
Assert.assertFalse(driver.findElement(By.cssSelector("input[id*='SeniorCitizenDiscount']")).isSelected());
System.out.println(driver.findElement(By.cssSelector("input[id*='SeniorCitizenDiscount']")).isSelected());
}
}
Here, assertFalse() will check the isSelected() methods output and if the output will be False, then only it will pass the test.