
Selenium Assignment – 6 (Snapdeal Login)
Scenario:
- Open a browser of your choice like Mozilla Firefox.
- Navigate to Snapdeal site (https://www.snapdeal.com/login)
- Enter Email Id or Phone Number.
- Enter password.
- Click login button.
- Verify that user is logged in successfully.
package com.test.traveltest;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class Assignment6 {
WebDriver driver;
String Url = "https://www.snapdeal.com/login";
//WebElement webFrame;
@BeforeClass
public void invokeBrowser(){
System.setProperty("webdriver.gecko.driver",
"D:\\Selenium\\geckodriver-v0.31.0-win64\\geckodriver.exe");
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(Url);
}
@Test
public void Test1() {
driver.findElement(By.id("userName")).sendKeys("r-----@gmail.com");
driver.findElement(By.id("checkUser")).click();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@Test
public void Test2() {
driver.findElement(By.className("otpValueCode")).sendKeys("0000");
driver.findElement(By.id("loginUsingOtp")).click();
}
@AfterTest
public void testComplete() {
driver.close();
}
}
4 COMMENTS
linetogel
linetogel
linetogel
linetogel