Back to Browse

TestNG AssertTrue and AssertFalse practical implementation | TestNG Malayalam Tutorial

479 views
Jun 27, 2023
31:40

TestNG Assertions | TestNG Framework Malayalam Tutorial Please find the Automation script below: import org.openqa.selenium.WebDriver; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.Assert; import org.testng.annotations.Test; public class Demo { // 1. Verify that the login button is displayed or not - True @Test(priority=1) public void validatePresenceOfLoginButton() { WebDriver driver = new ChromeDriver(); driver.get("https://www.facebook.com/"); WebElement loginBtn = driver.findElement(By.name("login")); Boolean displayFlag = loginBtn.isDisplayed(); //true Assert.assertTrue(displayFlag); } // 2. Verify that the login button is enabled or not - True @Test(priority=2) public void validateEnabilityOfLoginButton() { WebDriver driver = new ChromeDriver(); driver.get("https://www.facebook.com/"); WebElement loginBtn = driver.findElement(By.name("login")); Boolean enableFlag = loginBtn.isEnabled(); //true Assert.assertTrue(enableFlag); } //3. Verify that female radio button on sign up page is selected or not @Test(priority=3) public void validateFemaleRadioButton() throws InterruptedException { WebDriver driver = new ChromeDriver(); driver.get("https://www.facebook.com/"); WebElement createNewAcBtn = driver.findElement(By.xpath("//a[@data-testid='open-registration-form-button']")); createNewAcBtn.click(); Thread.sleep(1000); WebElement femaleRadioBtn = driver.findElement(By.xpath("(//form//input[@type='radio'])[1]")); Boolean selectionFlag = femaleRadioBtn.isSelected(); //False Assert.assertFalse(selectionFlag); } } #testng #testNGtutorial #assert #seleniumwebdriver #selenium #seleniumtutorial #technology #webdriver #java #javaprogramming #coding #xpath #testing #testingtools #automation #automationinmalayalam #seleniumtesting #seleniumautomation

Download

1 formats

Video Formats

360pmp443.6 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

TestNG AssertTrue and AssertFalse practical implementation | TestNG Malayalam Tutorial | NatokHD