コード例 #1
0
ファイル: EnquiryPage.cs プロジェクト: mhakimov/appium
        public void EnterPostcodeAndLookup(string postcode)
        {
            Random rnd = new Random();

            Postcode.SendKeys(postcode);
            FindAddressBtn.Click();

            var AddressDropDownCount = AddressLookupDrpDwn.Count();

            Console.WriteLine("Using @FindBys, we found " + AddressLookupDrpDwn.Count() + " element(s)");

            if (AddressDropDownCount == 1)
            {
                var ChooseAddress = AddressLookupDrpDwn.ElementAt(0);
                AddressLookupDrpDwn.ElementAt(0).Click();
            }
            else
            {
                if (AddressDropDownCount != 0)
                {
                    var RandAddress   = rnd.Next(1, AddressDropDownCount);
                    var ChooseAddress = AddressLookupDrpDwn.ElementAt(RandAddress);
                    AddressLookupDrpDwn.ElementAt(RandAddress).Click();
                }

                else
                {
                    Assert.False(AddressDropDownCount != 0, "There wasnt any addresses in the postcode");
                }
            }
        }
コード例 #2
0
        public void FillRegistrationForm(UserModel user)
        {
            Gender[(int)AutomationPractice.Gender.Female].Click();

            FirstName.SendKeys(user.FirstName);
            LastName.SendKeys(user.LastName);
            Password.SendKeys(user.Password);

            var date = new SelectElement(DayDateDropDown.WrappedElement);

            date.SelectByValue(user.Day);

            var month = new SelectElement(MonthDateDropDown.WrappedElement);

            month.SelectByValue(user.Month);

            var year = new SelectElement(YearDateDropDown.WrappedElement);

            year.SelectByValue(user.Year);

            Address.SendKeys(user.Address);
            City.SendKeys(user.City);
            Postcode.SendKeys(user.PostCode);
            PhoneMobile.SendKeys(user.Phone);

            var state = new SelectElement(StateDropDown.WrappedElement);

            state.SelectByText(user.State);
        }
コード例 #3
0
 public void Question(string textToEnter, string name, string email, string age, string postcode)
 {
     QuestionLink.Click();
     QuestionField.Click();
     QuestionField1.SendKeys(textToEnter);
     Name.SendKeys(name);
     Email.SendKeys(email);
     Age.SendKeys(age);
     Postcode.SendKeys(postcode);
     SubmitButton.Click();
 }
コード例 #4
0
        public void FillForm(AutoPracticeFormModel user)
        {
            FirstName.SendKeys(user.FirstName);
            LastName.SendKeys(user.LastName);
            Password.SendKeys(user.Password);
            Adress.SendKeys(user.Adress);
            City.SendKeys(user.City);
            State(user.State).Click();
            Postcode.SendKeys(user.Postcode);
            PhoneNumber.SendKeys(user.PhoneNumber);

            Driver.ScrollTo(SubmitButton);
            SubmitButton.Click();
        }
コード例 #5
0
 public void FillForm(RegistrationUser user)
 {
     Gender[0].Click();
     FirstName.SendKeys(user.FirstName);
     LastName.SendKeys(user.LastName);
     Password.SendKeys(user.Password);
     Day.SelectByValue(user.Day);
     Month.SelectByValue(user.Month);
     Year.SelectByValue(user.Year);
     RealFirstName.SendKeys(user.RealFirstName);
     RealLastName.SendKeys(user.RealLastName);
     Address.SendKeys(user.Address);
     City.SendKeys(user.City);
     State.SelectByText(user.State);
     Postcode.SendKeys(user.Postcode);
     Phone.SendKeys(user.Phone);
     Alias.SendKeys(user.Alias);
     RegisterButton.Click();
 }
コード例 #6
0
        //Method created for saving data in Edit Contact window
        public void SaveEditContactwithValidData()
        {
            ExcelLib.PopulateInCollection(Test.Base.ExcelPath, "Employees");

            Driver.wait(2);
            // ClearAllFieldsOnEditContactForm();

            FirstName.SendKeys(ExcelLib.ReadData(10, "FirstName"));
            LastName.SendKeys(ExcelLib.ReadData(10, "LastName"));
            Phone.SendKeys(ExcelLib.ReadData(10, "Phone"));
            Email.SendKeys(ExcelLib.ReadData(10, "Email"));
            Street.SendKeys(ExcelLib.ReadData(10, "Street"));
            City.SendKeys(ExcelLib.ReadData(10, "City"));
            Postcode.SendKeys(ExcelLib.ReadData(10, "Post"));
            Country.SendKeys(ExcelLib.ReadData(10, "Country"));

            Driver.wait(2);


            try
            {  // Check if User is able to save
                Save_Contact_btn.Click();
                Driver.driver.SwitchTo().ParentFrame();
                Driver.wait(2);
                Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Save button clicked succesfully on Edit Contact Popup Window");
            }
            catch (Exception e)
            {
                Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Unable to save Contact details on Edit Contact Popup Window");
            }
            try
            {
                //Check is Edit client window closes and control switches back to Create  New Employee Page
                IWebElement x          = Driver.driver.FindElement(By.XPath("html/body/div[4]/h2"));
                string      Page_title = x.Text;
                Console.WriteLine(Page_title);
                Assert.AreEqual("Employee Details", Page_title);
                Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Sucessully switched back to Page with EMPLOYEE DETAILS title");
            }
            catch (Exception e)
            {
                Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Failed to navigate back to Page with EMPLOYEE DETAILS title ");
            }
            try
            {
                //Check if Edit contact/ Edit Billing Contact textfield is disabled and loaded with contact details



                // for Edit Contact Textfield
                IWebElement j             = Driver.driver.FindElement(By.XPath("html/body/div[4]/form/div/div[3]/div/input"));
                bool        Txtbox_status = j.Enabled;
                Console.WriteLine(Txtbox_status);
                //string val = j.GetAttribute("value");
                //Console.WriteLine(j);

                Assert.AreEqual("False", Convert.ToString(Txtbox_status));
                Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Test Pass: Edit contact Textbox is disabled as it is populated by contact details");
            }
            catch (Exception e)
            {
                Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Fail: Edit contact Textbox is still enabled and blank");
            }
        }
コード例 #7
0
        // Create a new Property
        internal void CreateProperty()
        {
            Global.ExcelLib.PopulateInCollection(Config.PropertyManagementResource.ExcelPath, "Property");
            //Explicit Wait
            Thread.Sleep(1000);
            //Click on Owners tab
            Owners.Click();
            //Click Properties option
            Properties.Click();
            //Click on Add New Property button
            AddPropertybtn.Click();
            Thread.Sleep(500);
            // ************PropertyDetails***************
            //Enter Property Name
            PropertyName.SendKeys(Global.ExcelLib.ReadData(2, "PropertyName"));
            Thread.Sleep(500);
            //Click on Property type dropdown
            PropertyTypeDropdown.Click();
            //Select the value from property type dropdown
            PropertyTypedropdownvalue.Click();
            //Enter Description
            Description.SendKeys(Global.ExcelLib.ReadData(2, "Description"));
            //Enter Street Number
            StreetNo.SendKeys(Global.ExcelLib.ReadData(2, "StreetNumber"));
            //Enter Street Name
            StreetName.SendKeys(Global.ExcelLib.ReadData(2, "StreetName"));
            //Enter Suburb
            Suburb.SendKeys(Global.ExcelLib.ReadData(2, "Suburb"));
            //Enter City
            City.SendKeys(Global.ExcelLib.ReadData(2, "City"));
            //Enter Postcode
            Postcode.SendKeys(Global.ExcelLib.ReadData(2, "PostCode"));
            //Enter Region
            Region.SendKeys(Global.ExcelLib.ReadData(2, "Region"));
            //Enter Target Rent
            TargetRent.SendKeys(Global.ExcelLib.ReadData(2, "TargetRent"));
            Thread.Sleep(1000);
            //Click on Rent drop down
            //RentTypeDropdown.Click();
            //Select value from Rent dropdown
            // RentTypeDropdownvalue.Click();
            //Enter Land Area
            LandArea.SendKeys(Global.ExcelLib.ReadData(2, "LandArea"));
            //Enter Floor Area
            FloorArea.SendKeys(Global.ExcelLib.ReadData(2, "FloorArea"));
            //Enter Bedroom
            Bedrooms.SendKeys(Global.ExcelLib.ReadData(2, "BedRooms"));
            //Enter Bathroom
            Bathrooms.SendKeys(Global.ExcelLib.ReadData(2, "BathRooms"));
            //Enter CarParks
            Carparks.SendKeys(Global.ExcelLib.ReadData(2, "CarParks"));
            Thread.Sleep(1000);
            //Enter Year built
            YearBuilt.SendKeys(Global.ExcelLib.ReadData(2, "YearBuilt"));
            // File Upload Approach1: Send Keys

            /*
             * FileUploadbtn.SendKeys(@"C:\Users\Shahabuddin\Desktop\Rumana\testiamge.jpg");
             * Thread.Sleep(1000);
             * photo.Click();
             */
            // File Upload Approach2: AutoIt- Handles windows that do not belong to browser
            photo.Click();
            FileUploadbtn.Click();
            AutoItX3 AutoIt = new AutoItX3();

            AutoIt.ControlFocus("Open", "", "Edit1");
            Thread.Sleep(2000);
            AutoIt.ControlSetText("Open", "", "Edit1", @"C:\Users\Shahabuddin\Desktop\Rumana\house2_image.jpg");
            Thread.Sleep(1000);
            AutoIt.ControlClick("Open", "", "Button1");

            //Click on Next button
            NextbtnProptertyDetails.Click();
            // ************Financialdetails***************
            //Enter Purchase Price
            purchaseprice.SendKeys(Global.ExcelLib.ReadData(2, "PurchasePrice"));
            //Enter Mortgage
            Mortgage.SendKeys(Global.ExcelLib.ReadData(2, "Mortgage"));
            //HomeValue
            HomeValue.SendKeys(Global.ExcelLib.ReadData(2, "HomeValue"));
            //Click on Home Value Type drop down
            HomeValueType.Click();
            //Select Home Value type
            HomeValueTypeSelection.Click();
            //Click on Add Repayment button
            AddRePayment.Click();
            //Enter Amount
            RePaymentAmount.SendKeys(Global.ExcelLib.ReadData(2, "RepaymentAmount"));
            //Enter RepaymentStartDate
            RePaymentStartdate.Clear();
            RePaymentStartdate.SendKeys("26/05/2018");
            Thread.Sleep(500);
            //Enter RepaymentEndDate
            RePaymentEnddate.Clear();
            RePaymentEnddate.SendKeys("29/06/2018");
            Thread.Sleep(500);
            //Click on Add Expense link
            AddExpense.Click();
            //Enter Expense Amount
            ExpenseAmount.SendKeys(Global.ExcelLib.ReadData(2, "ExpenseAmount"));
            // Enter Expense Description
            ExpenseDescription.SendKeys(Global.ExcelLib.ReadData(2, "ExpenseDescription"));
            //Enter date for ExpenseDate
            //ExpenseDateCalender.Clear();
            ExpenseDateCalender.SendKeys("30/06/2018");
            Thread.Sleep(500);
            //Click on Next button
            NextbtnFinanceDetails.Click();
            // ************Tenantdetails***************
            //Enter TenantEmail
            TenantEmail.SendKeys(Global.ExcelLib.ReadData(2, "TenantEmail"));
            //Click on IsmainTenant
            IsMainTenant.Click();
            //Select IsmainTenant
            IsMainTenantSelectYes.Click();
            //Enter Tenant FirstName
            TenantFirstName.SendKeys(Global.ExcelLib.ReadData(2, "TenantFirstName"));
            //Enter Tenant LastName
            TenantLastName.SendKeys(Global.ExcelLib.ReadData(2, "TenantLastName"));
            //Enter Tenant StartDate
            TenantStartDate.Clear();
            TenantStartDate.SendKeys("20/06/2018");
            //Enter Tenant EndDate
            TenantEndDate.Clear();
            TenantEndDate.SendKeys("30/09/2018");
            //Enter TenantRentAmount
            TenantRentAmount.SendKeys(Global.ExcelLib.ReadData(2, "TenantRentAmount"));
            Thread.Sleep(1000);
            //Click on PaymentfrequencyDropdown
            //PaymentFrequencydropdown.Click();
            //Select Monthly from PaymentFrequencyDropdown
            //PaymentFrequencydropdownMonth.Click();
            //TenantPaymentStartdate
            TenantPaymentStartdate.Clear();
            TenantPaymentStartdate.SendKeys("10/07/2018");
            Thread.Sleep(1000);
            //Click on PaymentDueDay drop down
            //PaymentDueDayDropdown.Click();
            //Select PaymentDueDay value
            //PaymentDueDayDropdownvalue.Click();
            //Click on AddNewLiabilityLink
            AddNewLiability.Click();
            //Click on LiabilityNameDropDown
            // LiabilityNameDropdown.Click();
            //Select Liability Name Dropdown value
            //LiabilityNameDropdownInsurance.Click();
            //Enter LiabilityAmount
            //LiabilityAmount.SendKeys(Global.ExcelLib.ReadData(2,"LiabilityAmount"));
            try
            {
                Assert.IsTrue(SavePropertyButton.Displayed);
            }
            catch (Exception e)
            {
                Console.Write(e);
            }
            //Click on Save button
            SavePropertyButton.Click();
            //Add Property Verification
            //Click on Owners tab
            Owners.Click();
            //Click Properties option
            Properties.Click();
            string msg1   = Global.GlobalDefinition.driver.FindElement(By.XPath("//*[@id='main-content']/section/div[1]/div/div[3]/div/div[1]/div/div/div[2]/div[1]/div[1]/a/h3")).Text;
            string Actmsg = Global.ExcelLib.ReadData(2, "CreatePropertyVerification");

            Thread.Sleep(2000);
            if (msg1 == Actmsg)
            {
                Global.Base.test.Log(LogStatus.Pass, "Test Passed, Record has been created successfully");
                Global.SaveScreenShotClass.SaveScreenshot(Global.GlobalDefinition.driver, "PropertyListAdded");
            }
            else
            {
                Global.Base.test.Log(LogStatus.Pass, "Test Failed, Record has not created");
            }
        }
コード例 #8
0
ファイル: PropertyDetails.cs プロジェクト: hnlord/A
        internal void GetDataFromExcel()
        {
            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.SendKeys(ExcelLib.ReadData(2, "YearBuilt"));
                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"));
                Carparks.SendKeys(Keys.Enter);
                Thread.Sleep(1000);

                //Click on the "Next" button
                NextButton.Click();
                Thread.Sleep(2000);
            }
            catch (Exception e)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Add Property Details Unsuccessfull", e.Message);
            }
        }
コード例 #9
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);
            }
        }