top of page

learner'sBlog

import java.time.Duration;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.Test;

public class ForgotPasswordTest {
	//private WebDriver driver;

	@Test
	public void testForgotPassword() throws InterruptedException {
		// Set up the WebDriver
		WebDriver driver = new ChromeDriver();
		WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); 
		// Navigate to the Forgot Password page
		driver.get("https://www.jootza.com/login");
		// Find the email input field and submit button
        WebElement forgotPasswordLink = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//p[@class='text-info font-15']")));
		forgotPasswordLink.click();
		WebElement emailInput = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("login-username")));
		// Enter a valid email address
		emailInput.sendKeys("testuser@example.com");
		WebElement submitButton = wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("button[type='submit']")));
		submitButton.click();
		WebElement confirmationMessage = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='toast-message ng-star-inserted']")));
		System.out.println(confirmationMessage.getText());
		String message = "We will email you a password reset link if you provided a valid username or email. Please check your registered email.";
		Assert.assertTrue(confirmationMessage.isDisplayed(), message);
			// Close the browser after each test method
		if (driver != null) {
			driver.quit();
		}
	}

}

Invalid Email

package seleniumAdvanced;

import java.time.Duration;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.Test;

public class InValidEmailForgotPassword {
	
	
	@Test
	public void invalidEmailForgotPword() {
		// Set up the WebDriver
		WebDriver driver = new ChromeDriver();
		WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); 
		// Navigate to the Forgot Password page
		driver.get("https://www.jootza.com/login");
		// Find the email input field and submit button
        WebElement forgotPasswordLink = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//p[@class='text-info font-15']")));
		forgotPasswordLink.click();
		WebElement emailInput = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("login-username")));
		// Enter a valid email address
		emailInput.sendKeys("testuser@123.com");
		WebElement submitButton = wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("button[type='submit']")));
		submitButton.click();
		WebElement confirmationMessage = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='toast-message ng-star-inserted']")));
		System.out.println(confirmationMessage.getText());
		String message = "We will email you a password reset link if you provided a valid username or email. Please check your registered email.";
		Assert.assertTrue(confirmationMessage.isDisplayed(), message);
			// Close the browser after each test method
		if (driver != null) {
			driver.quit();
		}
	}

}


3 views0 comments

SQL Commands

Structured query language (SQL) is a programming language for storing and processing information in a relational database. A relational database stores information in tabular form, with rows and columns representing different data attributes and the various relationships between the data values.






Table 2

4 views0 comments
bottom of page