Exemplo n.º 1
0
        public void Enterpropertydetails()
        {
            _Wait.Until(ExpectedConditions.ElementExists(By.ClassName("title")));
            string propdetpag = _driver.Title;

            Assert.AreEqual(propdetpag, "Properties | Add New Property");
            Propertyname.SendKeys("NewProperty");

            /* Actions actions = new Actions(_driver);
             * actions.MoveToElement(PropertyType);
             * actions.Click();
             * actions.SendKeys("Section and Property");
             * actions.Build().Perform();*/

            StreetNo.SendKeys("1222");

            IWebElement streetname = AddressElement1[0];

            streetname.SendKeys("High Street");

            IWebElement Suburb = AddressElement1[1];

            Suburb.SendKeys("Taita");

            IWebElement City     = AddressElement2[1];
            IWebElement Postcode = AddressElement2[2];

            City.SendKeys("Lower Hutt");


            Postcode.SendKeys("5011");

            PropDes.SendKeys("Property Description");

            Region.SendKeys("Wellington");

            System.Threading.Thread.Sleep(4000);

            TargetRent.SendKeys("200");
            Bedrooms.SendKeys("2");
            YearBuilt.SendKeys("1999");
            Bathrooms.SendKeys("2");

            Fileupload.SendKeys(@"C:\Users\Mallik\Desktop\Test.jpg");
            CarPark.SendKeys("2");

            System.Threading.Thread.Sleep(1000);

            //File IUpload

            /*  System.Threading.Thread.Sleep(2000);
             *
             * SendKeys.SendWait(@"C:\Users\Mallik\Desktop\Test.jpg");
             * System.Threading.Thread.Sleep(2000);
             *
             * SendKeys.SendWait(@"{Enter}");
             */

            YearBuilt.Click();
            System.Threading.Thread.Sleep(1000);
            ClickNext.Click();
        }
Exemplo n.º 2
0
        //Edit a property from Excel data
        internal void EditAPropertyFromExcelData()
        {
            try
            {
                // Populating the data from Excel
                ExcelLib.PopulateInCollection(Base.ExcelPath, "PropertyDetails");

                //Edit name textbox
                PropertyName.Clear();
                Thread.Sleep(1000);
                PropertyName.SendKeys(ExcelLib.ReadData(2, "Property Name"));

                //Edit description textbox
                Description.Clear();
                Thread.Sleep(1000);
                Description.SendKeys(ExcelLib.ReadData(2, "Description"));

                //Edit Number textbox
                StreetNumber.Clear();
                Thread.Sleep(1000);
                StreetNumber.SendKeys(ExcelLib.ReadData(2, "Number"));

                //Edit Street textbox
                Street.Clear();
                Thread.Sleep(1000);
                Street.SendKeys(ExcelLib.ReadData(2, "Street"));

                //Edit Suburb  textbox
                Suburb.Clear();
                Thread.Sleep(1000);
                Suburb.SendKeys(ExcelLib.ReadData(2, "Suburb"));

                //Edit City textbox
                City.Clear();
                Thread.Sleep(1000);
                City.SendKeys(ExcelLib.ReadData(2, "City"));

                //Edit Postcode  textbox
                Postcode.Clear();
                Thread.Sleep(1000);
                Postcode.SendKeys(ExcelLib.ReadData(2, "Postcode"));

                //Edit Region   textbox
                Region.Clear();
                Thread.Sleep(1000);
                Region.SendKeys(ExcelLib.ReadData(2, "Region"));


                //Select Year in Year Built
                YearBuilt.Click();
                Thread.Sleep(1000);
                var selectElement = new SelectElement(YearBuilt);

                //select by text
                string sYear = ExcelLib.ReadData(2, "YearBuilt");
                //Debug.Assert(sYear == "1977");
                selectElement.SelectByText(sYear);
                Thread.Sleep(1000);


                //Edit Target Rent  textbox
                TargetRent.Clear();
                Thread.Sleep(1000);
                TargetRent.SendKeys(ExcelLib.ReadData(2, "Target Rent"));

                //Edit Bed rooms textbox
                Bedrooms.Clear();
                Thread.Sleep(1000);
                Bedrooms.SendKeys(ExcelLib.ReadData(2, "Bedrooms"));

                //Edit Bath rooms textbox
                Bathrooms.Clear();
                Thread.Sleep(1000);
                Bathrooms.SendKeys(ExcelLib.ReadData(2, "Bathrooms"));


                //Edit Carparks textbox
                Carparks.Clear();
                Thread.Sleep(1000);
                Carparks.SendKeys(ExcelLib.ReadData(2, "Carparks"));


                //Click on the "Save" button
                SaveButton.Click();
                Thread.Sleep(2000);
            }
            catch (Exception e)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Edit Unsuccessfull", e.Message);
            }
        }