Assignment 6: Automate "User Registration" Process for E-commerce Website using Selenium

Automate important scenarios for dummy e-commerce website using Selenium with Java:
  1. User Registration
Assignment 6 - Automate User Registration of Dummy E-Commerce Website 

Automation Level - Intermediate

Steps to Automate:


2. Click on sign in link.

3. Enter your email address in 'Create and account' section.

4. Click on Create an Account button.

5. Enter your Personal Information, Address and Contact info.

6. Click on Register button.

7. Validate that user is created.

If you find it difficult to automate above steps, then follow the reference link.




Reference Links for Solution :

Read - Selenium Webdriver Tutorials Series


Join Telegram channel at https://t.me/techlistic
Feel free to ask queries or share your thoughts in comments or email me.

Comments

  1. package com.testUKR;

    import java.util.concurrent.TimeUnit;

    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.Select;
    import io.github.bonigarcia.wdm.WebDriverManager;

    public class EcomSignUp {

    public static void main(String[] args) {
    // TODO Auto-generated method stub
    WebDriverManager.chromedriver().setup();
    WebDriver driver=new ChromeDriver();
    String URL="http://automationpractice.com/index.php";

    driver.get(URL);
    driver.manage().timeouts().implicitlyWait(2000, TimeUnit.MILLISECONDS);
    driver.manage().window().maximize();
    //Click on Sign in
    driver.findElement(By.linkText("Sign in")).click();
    //Enter email address
    driver.findElement(By.cssSelector("[name='email_create']")).sendKeys("test1249@test.com");
    //Click on "Create an account"
    driver.findElement(By.xpath("//button[@name=\"SubmitCreate\"]")).click();
    //Select Title
    driver.findElement(By.xpath("//input[@id=\"id_gender1\"]")).click();
    driver.findElement(By.name("customer_firstname")).sendKeys("Test User");
    driver.findElement(By.name("customer_lastname")).sendKeys("Vsoft");
    driver.findElement(By.id("passwd")).sendKeys("PKR@PKR");
    //under your address
    driver.findElement(By.id("firstname")).sendKeys("Test User");
    driver.findElement(By.id("lastname")).sendKeys("Vsoft");
    driver.findElement(By.id("company")).sendKeys("Vsoft");
    driver.findElement(By.id("address1")).sendKeys("Test 81/1,2nd cross");
    driver.findElement(By.id("city")).sendKeys("Haridwar");
    WebElement statedropdown=driver.findElement(By.name("id_state"));
    Select oSelect=new Select(statedropdown);
    oSelect.selectByValue("4");

    driver.findElement(By.name("postcode")).sendKeys("51838");
    WebElement countrydropDown=driver.findElement(By.name("id_country"));
    Select oSelectC=new Select(countrydropDown);
    oSelectC.selectByVisibleText("United States");
    //Enter Mobile Number
    driver.findElement(By.id("phone_mobile")).sendKeys("8123812381");
    driver.findElement(By.xpath("//input[@name=\"alias\"]")).clear();
    driver.findElement(By.xpath("//input[@name=\"alias\"]")).sendKeys("Office");
    driver.findElement(By.name("submitAccount")).click();
    String userText=driver.findElement(By.xpath("//*[@id=\"header\"]/div[2]/div/div/nav/div[1]/a")).getText();

    if(userText.contains("Vsoft")) {
    System.out.println("User Verified,Test case Passed");
    }
    else
    {
    System.out.println("User Verification Failed,Test case Failed");
    }
    }
    }

    ReplyDelete

Post a Comment

Popular Posts

Top 10 Demo Websites to Practice Selenium Webdriver Online

How To Handle Dynamic Xpaths (Web Table) in Selenium WebDriver

How to Take Screenshot and Partial Screenshot in Selenium WebDriver

Selenium WebDriver - Browser and Navigation Commands

Automation Framework Building 1st step - Implementing Code Re-usablility