Select dob from dropdown project

 There are more available on https://play.google.com/store/apps/details?id=com.master.askmastermaterial

Description:

*select dob from dropdown,select day,month,year dropdown

*different type of select should be used for each dropdown 

*suggested site : fb

*launch any browser go to fb site

*locate firstname

*enter details

*select dob

* verify dob by selected year

*close browser


Solution:



 
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;
 
 
public class openfb {
 
 
    
 
        public static void main(String[] args) throws InterruptedException {
 
            
 
            
 
            System.setProperty("webdriver.chrome.driver","location    of your webdriver in computer");
 
            WebDriver driver= new ChromeDriver();
 
            driver.get("https://www.fb.com/");
 
            driver.manage().window().maximize();
 
                        WebElement create_new_acc= driver.findElement(By.linkText("Create New Account"));   //clicking on create new account button
 
                create_new_acc.click();
 
                Thread.sleep(5000)
 
            
 
            driver.findElement(By.name("firstname")).sendKeys("xxxxxxxx");
 
            driver.findElement(By.name("lastname")).sendKeys("xxxxxxx");
 
            driver.findElement(By.name("reg_email__")).sendKeys("xxxxxxx@gmail.com");
 
            driver.findElement(By.name("reg_email_confirmation__")).sendKeys("xxxxxxxx@gmail.com");
 
            driver.findElement(By.name("reg_passwd__")).sendKeys("xxxxxxx");
 
 
            Thread.sleep(3000);
 
            WebElement  date =driver.findElement(By.xpath("//select[@name='birthday_day']"));
 
            Select selectData=new Select(date);
 
            selectData.selectByVisibleText("5");
 
            
 
            WebElement  month =driver.findElement(By.xpath("//select[@name='birthday_month']"));             
 
                    Select selectMonth =new Select(month);
 
                    selectMonth.selectByIndex("5");
 
 
            
 
            WebElement  Year =driver.findElement(By.xpath("//select[@name='birthday_year']"));
 
            Select selectYear =new Select(Year);
 
            selectYear.selectByValue("2000");
 
            
 
            Thread.sleep(3000);
 
            
 
            driver.quit();
 
        }            
 
 
}


Comments:

This is rough solution,verified but not available as zip as of now. Please do by yourself. Hope it will be helpful

*verify dob not implemented please check video for that and doubts.

Comments

Popular posts from this blog

Cognizant Html css js CC

Java sba