public void EnterTenantDet() { _Wait.Until(ExpectedConditions.ElementExists(By.XPath("//*[@id='lname']"))); TenantEmail.SendKeys("*****@*****.**"); TenantFullname.SendKeys("Tenant"); TenantLastName.SendKeys("TenantLast"); RentAmt.SendKeys("200"); /* IJavaScriptExecutor js = (IJavaScriptExecutor)_driver; * js.ExecuteScript(StartDate.startD); * * String startD = "24/09/2018"; */ StartDate.SendKeys("24/09/2018"); StartDate.Click(); System.Threading.Thread.Sleep(1000); EndDate.SendKeys("24/08/2028"); EndDate.Click(); System.Threading.Thread.Sleep(1000); PaymentStartDate.SendKeys("24/09/2018"); PaymentStartDate.Click(); System.Threading.Thread.Sleep(1000); Liabilities.Click(); _Wait.Until(ExpectedConditions.ElementExists(By.XPath("//*[@id='LiabilityDetail']/div/div[1]/div[2]/div[1]/input"))); ValLiabilities.SendKeys("1000"); ClickSave.Click(); }
public void EnterStartDateMechanicLeaveDetails(int index, string selectMonth, string selectYear, string selectdate) { //CustomLib.FluentWaitbyXPath(Drive.driver, "AddMechanicLeaves"); //AddMechanicLeaves.Click(); if (DateRange.Selected) { CustomWait.WaitFortheLoadingIconDisappear2000(); PassComment.SendKeys("Today I am Not feeling Well."); StartDate.Click(); CustomWait.WaitFortheLoadingIconDisappear2000(); CustomLib.HandleCalendar(index, selectMonth, selectYear, selectdate); CustomWait.WaitFortheLoadingIconDisappear5000(); } }
internal void Share_Skill() { Console.WriteLine("Start of shareSkill Method"); //extent Reports // Base.test = Base.extent.StartTest("Login Test"); //Click on ShareSkill Share_skill.Click(); Thread.Sleep(2000); //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); Thread.Sleep(1000); //Enter Title Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Thread.Sleep(1000); //Enter Description Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Thread.Sleep(1000); //Click on Category Category.Click(); //Enter Category var selectElement = new SelectElement(Category); selectElement.SelectByText(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category")); Thread.Sleep(2000); //Click on Sub Category SubCategory.Click(); Thread.Sleep(3000); //Enter Sub Category var selectElementSub = new SelectElement(SubCategory); selectElementSub.SelectByText(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Sub Category")); Thread.Sleep(1000); //Click on tags Tags.Click(); //Enter a tag Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); //Select a Service Type ServiceType.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Service Type")); //Select Location Type locationType.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Location Type")); //Click on Avaliable days StartDate.Click(); Thread.Sleep(1000); //Select Available days StartDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Date")); //Click on Sunday Checkbox Checkbox.Click(); Thread.Sleep(1000); //Select Start Time StartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Time")); //Select Skill Trade skillTrades.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade")); //Select Skill-Exchange SkillExchange.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Skill Exchange")); Thread.Sleep(2000); //Click on plus icon of Work Samples Work_Samples.Click(); Thread.Sleep(3000); //Call AutoIt to choose a file AutoItX.ControlFocus("Open", "", "Edit1"); AutoItX.ControlSetText("Open", "", "Edit1", @"D:\kavya\AutoIt"); AutoItX.ControlClick("Open", "", "Button1"); //Select Active Active.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Active")); //Click on Save Save.Click(); }
public void AddNewShareSkill() { #region Navigate to Share Skills Page // Click on Share Skills Page ShareSkills.Click(); Thread.Sleep(1000); //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); // Enter Title Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Base.test.Log(LogStatus.Info, "Title has been successfully entered"); //Enter description Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Base.test.Log(LogStatus.Info, "Description has been successfully entered"); //click on category dropdown menu Thread.Sleep(500); Category.Click(); Thread.Sleep(1000); //Select the category ProgrammingandTech.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category")); Thread.Sleep(1000); //Click on subcatogory drop down option Thread.Sleep(1000); SubCategory.Click(); //Select the Sub-Category option SubCategory.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Subcategory")); SubCategory.SendKeys(Keys.Enter); Base.test.Log(LogStatus.Info, "SubCategory has been successfully entered"); QA.Click(); //Enter Tags Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); Base.test.Log(LogStatus.Info, "TagName has been successfully entered"); //Select service type //ServiceTypeHourly.Click(); if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "Hourly basis service") { ServiceTypeHourly.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "One-off service") { ServiceTypeOneOff.Click(); } //Select Location Type //LocationTypeOnline.Click(); if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "Online") { LocationTypeOnline.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "On-site") { LocationTypeOnsite.Click(); } //Click the start date StartDate.Click(); Thread.Sleep(500); //Select the date Thread.Sleep(500); StartDate.SendKeys(Keys.Backspace); StartDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Date")); //Select the end Date Thread.Sleep(1000); EndDate.SendKeys(Keys.Backspace); EndDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "End Date")); //Select the Days available selectDays.Click(); Thread.Sleep(500); //Select starttime Thread.Sleep(1000); StartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Time")); //Select EndTime Thread.Sleep(1000); EndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "End Time")); //Select Skill Trade Credit.Click(); Thread.Sleep(500); if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Skill-exchange") { RequiredSkills.Click(); RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade")); RequiredSkills.SendKeys(Keys.Enter); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Credit") { CreditAmount.Click(); CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit Amount")); CreditAmount.SendKeys(Keys.Enter); //Enter credit amount // CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit Amount")); //Select the stats // StatusActive.Click(); //Thread.Sleep(500); if (GlobalDefinitions.ExcelLib.ReadData(2, "Status") == "Active") { StatusActive.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "Status") == "Hidden") { StatusHidden.Click(); } //Save the Share Skill Thread.Sleep(500); SaveShareSkills.Click(); Thread.Sleep(500); //Verify if newShared skill is saved Thread.Sleep(3000); string ShareSkillSucess = Global.GlobalDefinitions.driver.FindElement(By.CssSelector("#listing-management-section > div:nth-child(3) > div:nth-child(2) > table > thead > tr > th:nth-child(1)")).Text; if (ShareSkillSucess == "Image") { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Saved Skill Successful"); } else { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Saving Skill Unsuccessful"); } } }
public void AddNewSkill() { #region Navigate to Share Skills Page // Click on Share Skills Page ShareSkill.WaitForElementClickable(_driver, 60); ShareSkill.Click(); //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkills"); #endregion #region Enter Title Title.WaitForElementClickable(_driver, 60); //Enter the data in Title textbox Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "title")); #endregion #region Enter Description //Enter the data in Description textbox Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EnterDescription")); #endregion #region Category Drop Down // Click on Category Dropdown Category.Click(); // Select Category from Category Drop Down var SelectElement = new SelectElement(Category); SelectElement.SelectByText((GlobalDefinitions.ExcelLib.ReadData(2, "category"))); // Click on Sub-Category Dropdown SubCategory.Click(); //Select Sub-Category from the Drop Down var SelectElement1 = new SelectElement(SubCategory); SelectElement1.SelectByText((GlobalDefinitions.ExcelLib.ReadData(2, "subcategory"))); #endregion #region Tags // Eneter Tag Tag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "TagName")); Tag.SendKeys(Keys.Enter); #endregion #region Service Type Selection // Service Type Selection if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis service") { ServiceTypeHourly.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off service") { ServiceTypeOnOff.Click(); } #endregion #region Select Location Type // Location Type Selection if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "On-site") { LocationTypeOnsite.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "Online") { LocationTypeOnline.Click(); } #endregion #region Select Available Dates from Calendar // Select Start Date StartDate.Click(); // Select End Date EndDate.Click(); #endregion #region Select Skill Trade // Select Skill Trade if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Skill-exchange") { RequiredSkills.Click(); RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "ExchangeSkill")); RequiredSkills.SendKeys(Keys.Enter); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Credit") { CreditAmount.Click(); CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "AmountInExchange")); CreditAmount.SendKeys(Keys.Enter); } #endregion #region Select User Status // Select User Status if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active") { StatusActive.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden") { StatusHidden.Click(); } #endregion #region Add Work Sample //Work Sample upload button path IWebElement upload = _driver.FindElement(By.XPath("//*[@id='selectFile']")); // Uploading File path var GetCurrentDirectory = Directory.GetCurrentDirectory(); String path = GetCurrentDirectory + @"\MarsFramework\Upload Files\Samplework.txt"; upload.SendKeys(path); #endregion #region Save / Cancel Skill // Save or Cancel New Skill if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save") { SaveShareSkills.Click(); } else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel") { CancelShareSkills.Click(); } #endregion #region Check whether New skill created sucessfully string ShareSkillSucess = _driver.FindElement(By.LinkText("Manage Listings")).Text; if (ShareSkillSucess == "Manage Listings") { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Shared Skill Successful"); } else { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Share Skill Unsuccessful"); } #endregion }
internal void editShareskill() { GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Service Data"); GlobalDefinitions.wait(1000); //Enter Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select Category SelectElement catg = new SelectElement(CategoryDropDown); GlobalDefinitions.wait(1000); catg.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select Subcategory OpenQA.Selenium.Support.UI.SelectElement subcatg = new SelectElement(SubCategoryDropDown); GlobalDefinitions.wait(1000); subcatg.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Sub Category")); //Tags GlobalDefinitions.wait(1000); Tags.Click(); GlobalDefinitions.wait(1000); Tags.SendKeys("FirstTag" + "\n"); //Select Service Type from radio buttons OneOffServiceType.Click(); //Select Location Type radio button onlineLocationType.Click(); //Select Available days and Time //select startdate StartDate.Click(); GlobalDefinitions.wait(1000); StartDate.SendKeys("25062020"); //Select end date EndDate.Click(); GlobalDefinitions.wait(1000); EndDate.SendKeys("25072020"); //Select Monday MondayCheckbox.Click(); //Select start time for Monday MondayStartTime.Click(); GlobalDefinitions.wait(1000); MondayStartTime.SendKeys("0930am"); GlobalDefinitions.wait(1000); //Select end time for Monday MondayendTime.Click(); GlobalDefinitions.wait(1000); MondayendTime.SendKeys("0530pm"); GlobalDefinitions.wait(1000); //Select Skill Trade radio button Creditradiobutton.Click(); GlobalDefinitions.wait(1000); GlobalDefinitions.wait(1000); SkillExchangeTags.Click(); GlobalDefinitions.wait(1000); SkillExchangeTags.SendKeys("FirstSTag" + "\n"); //Select Active radio button ActiveRadiobutton.Click(); //Save the data GlobalDefinitions.wait(1000); Savebutton.Click(); GlobalDefinitions.wait(1000); }
public void FillDetailsOfServiceProvided() { //Wait for the share skill page to be loaded and until title field text box is visible Wait.ElementIsVisible(driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[1]/div/div[2]/div/div[1]/input"); //Read the data for Title from excel and enter the data into the Title Textbox Title.SendKeys(ServiceData.TitleData(RowNum)); //Read the data for Description from excel and enter the data into the Description Textbox Description.SendKeys(ServiceData.DescriptionData(RowNum)); //Read the Category name from the excel var CategoryData = ServiceData.CategData(RowNum); //Read the Subcategory name from the excel var SubCategoryData = ServiceData.SubCategData(RowNum); SelectElement CategorySelect = new SelectElement(Category); //Select the required Category from the dropdown CategorySelect.SelectByText(CategoryData); SelectElement SubCategorySelect = new SelectElement(SubCategory); //Select the required SubCategory from the dropdown SubCategorySelect.SelectByText(SubCategoryData); //Read the Skill exchange tag count from the excel var SkillExchngCount = ServiceData.TagsCntData(RowNum); int Count = Int32.Parse(SkillExchngCount); int TagsCount = Int32.Parse(ServiceData.TagsDataCount(RowNum)); int DaysCnt = Int32.Parse(ServiceData.AvailableDaysCnt(RowNum)); //Fill in the Start and End times for all days for (int TagCount = 0; TagCount < TagsCount; TagCount++) { //Read the data for Tags from excel and enter the data into the Tags field Tags.SendKeys(ExcelLibHelpers.ReadData((TagCount + RowNum), "Tags")); //Press ENTER key to add the tag Tags.SendKeys(Keys.Enter); } //Read the Service Type data from excel into a variable var ServiceTypeData = ServiceData.SrvcTypeData(RowNum); //Read the Location Type data from excel into a variable var LocationTypeData = ServiceData.LocatnTypeData(RowNum); //Read the Skill Trade data from excel into a variable var SkillTradeData = ServiceData.SkillTrdeData(RowNum); //Read the Active Status data from excel into a variable var ActiveStatusData = ServiceData.ActvStatusData(RowNum); //Choose Service Type ChooseServiceType(ServiceTypeData); //Choose Location Type ChooseLocationType(LocationTypeData); //Choose Skill Trade ChooseSkillTrade(SkillTradeData, Count); //Click on the 'Start date' field StartDate.Click(); //Read the Start Date data from the excel var StartDateData = ServiceData.StrtDateData(RowNum); //Read the End Date data from the excel var EndDateData = ServiceData.EndDateData(RowNum); //Initialse the variable that hold StartTime and EndTime var StartTimeData = "000000"; var EndTimeData = "000000"; //Clear the field before adding the date StartDate.Clear(); //Enter the data for 'Start date' from excel StartDate.SendKeys(StartDateData); Wait.wait(1, driver); //Click on the 'End date' field EndDate.Click(); //Clear the 'End date' EndDate.Clear(); //Enter the data for 'End date' from excel EndDate.SendKeys(EndDateData); //Select the Start time, End time, Available Days for (int DaysCount = 0; DaysCount < DaysCnt; DaysCount++) { if (ServiceData.AvailableDays(RowNum) == "Sun") { CheckBox[0].Click(); StartTimeData = ServiceData.StrtTimeData(RowNum); EndTimeData = ServiceData.EndTimeData(RowNum); StartTime[0].Click(); StartTime[0].SendKeys(StartTimeData); EndTime[0].Click(); EndTime[0].SendKeys(EndTimeData); } else if (ServiceData.AvailableDays(RowNum) == "Mon") { StartTimeData = ServiceData.StrtTimeData(RowNum); EndTimeData = ServiceData.EndTimeData(RowNum); CheckBox[1].Click(); StartTime[1].Click(); StartTime[1].SendKeys(StartTimeData); EndTime[1].Click(); EndTime[1].SendKeys(EndTimeData); } else if (ServiceData.AvailableDays(RowNum) == "Tue") { StartTimeData = ServiceData.StrtTimeData(RowNum); EndTimeData = ServiceData.EndTimeData(RowNum); CheckBox[2].Click(); StartTime[2].Click(); StartTime[2].SendKeys(StartTimeData); EndTime[2].Click(); EndTime[2].SendKeys(EndTimeData); } else if (ServiceData.AvailableDays(RowNum) == "Wed") { StartTimeData = ServiceData.StrtTimeData(RowNum); EndTimeData = ServiceData.EndTimeData(RowNum); CheckBox[3].Click(); StartTime[3].Click(); StartTime[3].SendKeys(StartTimeData); EndTime[3].Click(); EndTime[3].SendKeys(EndTimeData); } else if (ServiceData.AvailableDays(RowNum) == "Thu") { StartTimeData = ServiceData.StrtTimeData(RowNum); EndTimeData = ServiceData.EndTimeData(RowNum); CheckBox[4].Click(); StartTime[4].Click(); StartTime[4].SendKeys(StartTimeData); EndTime[4].Click(); EndTime[4].SendKeys(EndTimeData); } else if (ServiceData.AvailableDays(RowNum) == "Fri") { StartTimeData = ServiceData.StrtTimeData(RowNum); EndTimeData = ServiceData.EndTimeData(RowNum); CheckBox[5].Click(); StartTime[5].Click(); StartTime[5].SendKeys(StartTimeData); EndTime[5].Click(); EndTime[5].SendKeys(EndTimeData); } else { StartTimeData = ServiceData.StrtTimeData(RowNum); EndTimeData = ServiceData.EndTimeData(RowNum); CheckBox[6].Click(); StartTime[6].Click(); StartTime[6].SendKeys(StartTimeData); EndTime[6].Click(); EndTime[6].SendKeys(EndTimeData); } RowNum++; } //Choose the Active status button ChooseActiveStatus(ActiveStatusData); //Click on the save button SaveButton.Click(); //Implicit wait Wait.wait(1, driver); }
internal void AddService() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); GlobalDefinitions.wait(10); //Check if user is able to click on ShareSkill button ShareSkillbtn.Click(); GlobalDefinitions.wait(10); Boolean isPresent = GlobalDefinitions.driver.FindElements(By.XPath("//input[@name='title']")).Count > 0; if (isPresent == true) { Base.test.Log(LogStatus.Pass, "Share Skill button is clicked Successfully"); } else { Base.test.Log(LogStatus.Fail, "Share Skill button Click is UnSuccessful"); } //Check if user is able to enter valid data as Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //checking for invalid data Boolean isError = GlobalDefinitions.driver.FindElements(By.XPath("//div[@class='ui basic red prompt label transition visible']")).Count > 0; if (isError == true) { if (Invalid.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Title Error Message")) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Error displayed as expected: First character must be an alphabet character or a number"); } } else { //Check if user is able to Enter Title Boolean isTitleFetched = GlobalDefinitions.driver.FindElements(By.XPath("//input[@value='Software Tester']")).Count > 0; if (isTitleFetched == true) { Base.test.Log(LogStatus.Pass, "Title is Fetched from The Excel Successfully"); } else { Base.test.Log(LogStatus.Fail, "Title is not fetched correctly"); } } //Check if user is able to enter valid data as description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //checking for invalid data if (isError == true) { if (Invalid.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Title Error Message")) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Error displayed as expected: Special characters are not allowed"); } } //code for valid data else { if (Description.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Description")) { Base.test.Log(LogStatus.Pass, "Description is Fetched from The Excel Successfully"); } else { Base.test.Log(LogStatus.Fail, "Description is not fetched correctly"); } } //Check if user is able to select Category CategoryId.Click(); IList <IWebElement> Category = CategoryId.FindElements(By.TagName("option")); int categorycount = Category.Count; for (int i = 0; i < categorycount; i++) { if (Category[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "CategoryId")) { Category[i].Click(); Base.test.Log(LogStatus.Pass, "Selected Category"); break; } else { Base.test.Log(LogStatus.Info, "Cant find Category"); } } //Check if user is able to choose Subcategory SubcategoryId.Click(); IList <IWebElement> SubCategory = SubcategoryId.FindElements(By.TagName("option")); int subcategorycount = SubCategory.Count; for (int j = 0; j < subcategorycount; j++) { if (SubCategory[j].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubcategoryId")) { SubCategory[j].Click(); Base.test.Log(LogStatus.Pass, "Selected Subcategory"); break; } else { Base.test.Log(LogStatus.Info, "Cant find Subcategory"); } } //Check if user is able to Enter valid tags Boolean isTagPresent = GlobalDefinitions.driver.FindElements(By.XPath("//span[contains(.,'test')]")).Count > 0; if (isTagPresent == true) { Base.test.Log(LogStatus.Info, "Tag already exists"); } else { Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); Tags.SendKeys(Keys.Tab); Base.test.Log(LogStatus.Pass, "Tag added successfully"); } //Check if user is able to select Service Type switch (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type")) { case "Hourlybasis": HourlybasisServiceButton.Click(); Base.test.Log(LogStatus.Pass, "Hourly basis service is selected"); break; case "One-off": OneoffServiceButton.Click(); Base.test.Log(LogStatus.Pass, "One-off service is selected"); break; } //Check if user is able to select Location Type switch (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type")) { case "On-site": OnsiteButton.Click(); Base.test.Log(LogStatus.Pass, "Onsite location type is selected"); break; case "Online": OnlineButton.Click(); Base.test.Log(LogStatus.Pass, "Online location type is selected"); break; } //Check if user is able to enter valid Date StartDate.Click(); GlobalDefinitions.wait(10); StartDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartDate")); //checking for invalid start date if (isError == true) { if (Invalid.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Title Error Message")) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Error displayed as expected: Start Date cannot be set to a day in the past"); } } EndDate.Click(); GlobalDefinitions.wait(10); EndDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndDate")); Day.Click(); GlobalDefinitions.wait(10); //Check if user is able to select Time StartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime")); EndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndTime")); Base.test.Log(LogStatus.Pass, "Availability is selected"); //Check if user is able to slect Skill-Trade switch (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade")) { case "Skill-exchange": SkillExchangebutton.Click(); Boolean isSkillTagPresent = GlobalDefinitions.driver.FindElements(By.XPath("//span[contains(.,'cooking')]")).Count > 0; if (isTagPresent == true) { Base.test.Log(LogStatus.Info, "Tag already exists"); } else { SkillTag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skills")); SkillTag.SendKeys(Keys.Enter); SkillTag.SendKeys(Keys.Tab); Base.test.Log(LogStatus.Pass, "SkillTag is fetched successfully"); } break; case "Credit": Creditbutton.Click(); Base.test.Log(LogStatus.Info, "Credit is selected"); Credit.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); Boolean isCreditFetched = GlobalDefinitions.driver.FindElements(By.XPath("//input[@value='10']")).Count > 0; if (isCreditFetched == true) { Base.test.Log(LogStatus.Pass, "Credit is Fetched from The Excel Successfully"); } else { Base.test.Log(LogStatus.Fail, "Credit is not fetched correctly"); } break; } //Check if user is able to Upload worksample using AutoIt tool WorkSample.Click(); Thread.Sleep(1000); AutoItX.WinActivate("Open"); AutoItX.Send(GlobalDefinitions.ExcelLib.ReadData(2, "Upload File Path")); Thread.Sleep(1000); AutoItX.Send("{Enter}"); Boolean isWorksampleUploaded = GlobalDefinitions.driver.FindElements(By.XPath("//a[text()='dd.txt']")).Count > 0; if (isWorksampleUploaded == true) { Base.test.Log(LogStatus.Pass, "Uploaded file successfully"); } else { Base.test.Log(LogStatus.Fail, "File Updation Unsuccessful"); } //Check if user is able to choose state switch (GlobalDefinitions.ExcelLib.ReadData(2, "State")) { case "Active": GlobalDefinitions.wait(60); Activebutton.Click(); Base.test.Log(LogStatus.Pass, "Active state is selected"); break; case "Hidden": Hiddenbutton.Click(); Base.test.Log(LogStatus.Pass, "Hidden state is selected"); break; } //Check if user is able to click Save button Savebtn.Click(); Base.test.Log(LogStatus.Pass, "Save button is clicked"); }