Exemple #1
0
 public AutoFillDto()
 {
     tab1 = new Tab1();
     tab2 = new Tab2();
     tab3 = new Tab3();
     tab4 = new Tab4();
 }
        private static void FillAddress(IWebDriver webDriver, Tab2 tab2)
        {
            if (tab2.AddressPremisesOfTransferee != "" && tab2.AddressPremisesOfTransferee != null)
            {
                var address1 = webDriver.FindElement(By.Id("Add_Line2"));
                address1.SendKeys(tab2.AddressPremisesOfTransferee);
            }
            if (tab2.AdressLine1OfTransferee != "" && tab2.AdressLine1OfTransferee != null)
            {
                var flot = webDriver.FindElement(By.Name("Add_Line1"));
                flot.SendKeys(tab2.AdressLine1OfTransferee);
            }
            if (tab2.AddressLine2OfTransferee != "" && tab2.AddressLine2OfTransferee != null)
            {
                var road = webDriver.FindElement(By.Name("Add_Line3"));
                road.SendKeys(tab2.AddressLine2OfTransferee);
            }
            var city = webDriver.FindElement(By.Name("Add_Line5"));

            city.SendKeys(tab2.CityOfTransferee);
            var state    = webDriver.FindElement(By.Name("Add_State"));
            var stateDDl = new SelectElement(state);

            stateDDl.SelectByText(tab2.StateOfTransferee);
            var pin = webDriver.FindElement(By.Name("Add_PIN"));

            pin.SendKeys(tab2.PinCodeOfTransferee);
            var email = webDriver.FindElement(By.Name("Add_EMAIL"));

            email.SendKeys(tab2.EmailOfOfTransferee);
            if (tab2.MobileOfOfTransferee != "" && tab2.MobileOfOfTransferee != null)
            {
                var mobile = webDriver.FindElement(By.Name("Add_MOBILE"));
                mobile.SendKeys(tab2.MobileOfOfTransferee);
            }
            var moreThanOeBuyer = "";

            if (tab2.IsCoTransferee)
            {
                moreThanOeBuyer = "Yes";
            }
            else
            {
                moreThanOeBuyer = "No";
            }
            var coBuyer    = webDriver.FindElement(By.Name("Buyer"));
            var coBuyerDDl = new SelectElement(coBuyer);

            coBuyerDDl.SelectByText(moreThanOeBuyer);


            if (tab2.AddressPremisesOfTransferor != "" && tab2.AddressPremisesOfTransferor != null)
            {
                var address1Trans = webDriver.FindElement(By.Name("transferer_Add_Line2"));
                address1Trans.SendKeys(tab2.AddressPremisesOfTransferor);
            }
            if (tab2.AddressLine1OfTransferor != "" && tab2.AddressLine1OfTransferor != null)
            {
                var flotTrans = webDriver.FindElement(By.Name("transferer_Add_Line1"));
                flotTrans.SendKeys(tab2.AddressLine1OfTransferor);
            }
            if (tab2.AddressLine2OfTransferor != "" && tab2.AddressLine2OfTransferor != null)
            {
                var roadTrans = webDriver.FindElement(By.Name("transferer_Add_Line3"));
                roadTrans.SendKeys(tab2.AddressLine2OfTransferor);
            }
            var cityTrans = webDriver.FindElement(By.Name("transferer_Add_Line5"));

            cityTrans.SendKeys(tab2.CityOfTransferor);
            var stateTrans    = webDriver.FindElement(By.Name("transferer_Add_State"));
            var stateDDlTrans = new SelectElement(stateTrans);

            stateDDlTrans.SelectByText(tab2.StateOfTransferor);
            var pinTrans = webDriver.FindElement(By.Name("transferer_Add_PIN"));

            pinTrans.SendKeys(tab2.PinCodeOfTransferor);
            if (tab2.EmailOfOfTransferor != "" && tab2.EmailOfOfTransferor != null)
            {
                var emailTrans = webDriver.FindElement(By.Name("transferer_Add_EMAIL"));
                emailTrans.SendKeys(tab2.EmailOfOfTransferor);
            }
            if (tab2.MobileOfOfTransferor != "" && tab2.MobileOfOfTransferor != null)
            {
                var mobiletrans = webDriver.FindElement(By.Name("transferer_Add_MOBILE"));
                mobiletrans.SendKeys(tab2.MobileOfOfTransferor);
            }

            var sellerOpt = "";

            if (tab2.IsCoTransferor)
            {
                sellerOpt = "Yes";
            }
            else
            {
                sellerOpt = "No";
            }

            var Seller    = webDriver.FindElement(By.Name("Seller"));
            var SellerDDl = new SelectElement(Seller);

            SellerDDl.SelectByText(sellerOpt);

            webDriver.FindElement(By.XPath("//a[@href='#next']")).Click();
        }