public void AddLanguage() { for (int i = 1; i <= NumberOfLanguagesToAdd; i++) { //Reading language data from excel sheet String languageData = GlobalDefinitions.ExcelLib.ReadData(i + 1, "Language"); Thread.Sleep(2000); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "(//div[@class='ui teal button '][contains(.,'Add New')])[1]", 6); //Clicking on Add new button addNewLanguageButton.Click(); //Entering the language data into the language textbox //Thread.Sleep(2000); GenericWait.ElementExists(GlobalDefinitions.driver, "XPath", "//input[@placeholder='Add Language']", 6); addNewLanguageText.SendKeys(languageData); //Selecting the language level GenericWait.ElementIsVisible(GlobalDefinitions.driver, "Name", "level", 6); SelectElement chooseLanguageLevel = new SelectElement(LanguageLevelDropdown); var languageLevelData = GlobalDefinitions.ExcelLib.ReadData(i + 1, "LanguageLevel"); chooseLanguageLevel.SelectByValue(languageLevelData); //Clicking Add button //Thread.Sleep(4000); GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", "//input[@class='ui teal button'][contains(@value, 'Add')]", 6); addButtonLangauge.Click(); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Add Language"); } }
public void DeleteSkill() { String SkillToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "SkillToDelete"); String SkillLevelToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "SkillLevelToDelete"); //Searching for the skill to delete from the skill list for (int j = 1; j <= SkillRecords.Count; j++) { String SkillValue = GlobalDefinitions.driver.FindElement(By.XPath(SkillsTableBody + "[" + j + "]" + "//tr//td[1]")).Text; String SkillLevelValue = GlobalDefinitions.driver.FindElement(By.XPath(SkillsTableBody + "[" + j + "]" + "//tr//td[2]")).Text; try { //Deleting a particular skill if found from the available skill list if (SkillValue == SkillToDelete && SkillLevelValue == SkillLevelToDelete) { GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", SkillsTableBody + "[" + j + "]" + "/tr[1]/td[3]/span[2]/i[1]", 5); GlobalDefinitions.driver.FindElement(By.XPath(SkillsTableBody + "[" + j + "]" + "/tr[1]/td[3]/span[2]/i[1]")).Click(); Thread.Sleep(2000); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "ClassName", "ns-box-inner", 4); String DeleteAlertPopupText = GlobalDefinitions.driver.FindElement(By.ClassName("ns-box-inner")).Text; Assert.IsTrue(DeleteAlertPopupText.Contains("deleted")); Base.test.Log(LogStatus.Pass, "The skill deleted from the list"); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Skills Deleted"); break; } } catch (Exception e) { Assert.Fail("Failed to delete the skill", e.Message); Base.test.Log(LogStatus.Fail, "The skill is not deleted from the list", e.Message); } } }
public void AddCertification() { for (int i = 1; i <= NumberOfCertificationDetailsToAdd; i++) { GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", "//th[contains(text(),'Certificate')]/..//div[text() = 'Add New']", 5); //Clicking the addNew button addNewButton_Certification.Click(); //Entering the Certification name GenericWait.ElementIsVisible(GlobalDefinitions.driver, "Name", "certificationName", 5); CertificationName.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i + 1, "CertificationName")); //Entering the certification from detail GenericWait.ElementIsVisible(GlobalDefinitions.driver, "Name", "certificationFrom", 5); CertificationFrom.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i + 1, "CertifiedFrom")); //Selecting the year SelectElement elementYear_drpdwn = new SelectElement(yearDropdown); elementYear_drpdwn.SelectByText(GlobalDefinitions.ExcelLib.ReadData(i + 1, "Year")); //Clicking add button //GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", "//input[contains(@class,'ui teal button ')][contains(value,'Add')]",5); Thread.Sleep(3000); AddButton_Certificate.Click(); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Certification added"); } }
//Check the user is present into the list and Click on the user public void SearchUserFromSearchUserTextBox(string name) { if (FilterSearchUser.Displayed) { //Entering the user name FilterSearchUser.SendKeys(name); // Get the users and click on the particular user GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//div[@class='results transition visible']/div[@class ='result']", 5); if (UserList.Count != 0) { foreach (var user in UserList) { string userName = user.FindElement(By.XPath("//div[@class='results transition visible']/div[@class ='result']//div/span")).Text; if (userName.ToLower().Equals(name.ToLower())) { Thread.Sleep(5000); Actions actions = new Actions(GlobalDefinitions.driver); actions.MoveToElement(user).Build().Perform(); user.Click(); Thread.Sleep(2000); Base.test.Log(LogStatus.Pass, "User found and clicked successfully"); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Service listed by user"); break; } } } else if (UserList.Count == 0) { Console.WriteLine("User not found"); Base.test.Log(LogStatus.Fail, "User not found"); } } }
public void AddEducation() { for (int i = 1; i <= NumberOfEducationDetailsToAdd; i++) { GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", "//th[contains(text(),'Degree')]/..//div[text() = 'Add New']", 5); //Clicking the addNew button addNewButton_Education.Click(); //Entering the College/University name collegeNameTextbox.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i + 1, "College/University Name")); //Entering the degree degreeTextbox.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i + 1, "Degree")); //Selecting the country SelectElement elementcountry_drpdwn = new SelectElement(countryDropdown); elementcountry_drpdwn.SelectByText(GlobalDefinitions.ExcelLib.ReadData(i + 1, "Country")); //Selecting the Title SelectElement elementtitle_drpdwn = new SelectElement(titleDropdown); elementtitle_drpdwn.SelectByText(GlobalDefinitions.ExcelLib.ReadData(i + 1, "Title")); //Selecting the year SelectElement elementyear_drpdwn = new SelectElement(yearDropdown); elementyear_drpdwn.SelectByText(GlobalDefinitions.ExcelLib.ReadData(i + 1, "Year")); //Clicking add button addButton_Education.Click(); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Education added"); } }
public void DeleteLanguage() { String languageToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "LanguageToDelete"); String languageLevelToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "LanguageLevelToDelete"); //Searching for the language to delete from the language list for (int j = 1; j <= LanguageRecords.Count; j++) { String LanguageValue = GlobalDefinitions.driver.FindElement(By.XPath(LanguageBody + "[" + j + "]" + "//tr//td[1]")).Text; String LanguageLevelValue = GlobalDefinitions.driver.FindElement(By.XPath(LanguageBody + "[" + j + "]" + "//tr//td[2]")).Text; try { //Deleting a particular language if found from the available language list if (LanguageValue == languageToDelete && LanguageLevelValue == languageLevelToDelete) { GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", LanguageBody + "[" + j + "]" + " / tr[1] / td[3] / span[2] / i[1]", 3); GlobalDefinitions.driver.FindElement(By.XPath(LanguageBody + "[" + j + "]" + "/tr[1]/td[3]/span[2]/i[1]")).Click(); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Delete Language"); String DeleteAlertPopupText = GlobalDefinitions.driver.FindElement(By.ClassName("ns-box-inner")).Text; Assert.IsTrue(DeleteAlertPopupText.Contains("deleted")); Base.test.Log(LogStatus.Pass, "The language deleted from the list"); break; } } catch (Exception e) { Base.test.Log(LogStatus.Fail, "The language is not deleted from the list", e.Message); } } }
public void AddSkills() { for (int i = 1; i <= NumberOfSkillsToAdd; i++) { //Reading skills data from excel sheet String skillsData = GlobalDefinitions.ExcelLib.ReadData(i + 1, "Skill"); //Clicking the Add New button GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", "//th[contains(text(),'Skill')]/..//div[text()='Add New']", 4); addNewSkillsButton.Click(); //Entering the skills data into the skill textbox GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//input[@placeholder='Add Skill']", 2); addNewSkillsText.SendKeys(skillsData); //Selecting the skills level GenericWait.ElementIsVisible(GlobalDefinitions.driver, "Name", "level", 2); SelectElement chooseLanguageLevel = new SelectElement(SkillsLevelDropdown); var skillLevelData = GlobalDefinitions.ExcelLib.ReadData(i + 1, "SkillLevel"); chooseLanguageLevel.SelectByValue(skillLevelData); GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", "//input[contains(@class,'ui teal button ')][contains(@value,'Add')]", 4); //Clicking Add button addButtonSkills.Click(); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Skills added"); } }
public void UpdateAddedSkill() { //Reading skill and updated skill level from the excel String skillToUpdate = GlobalDefinitions.ExcelLib.ReadData(2, "SkillToUpdate"); String skillLevelToUpdate = GlobalDefinitions.ExcelLib.ReadData(2, "SkillLevelToUpdate"); //Searching through the skill list to find a skill need to be updated for (int j = 1; j <= SkillRecords.Count; j++) { String SkillValue = GlobalDefinitions.driver.FindElement(By.XPath(SkillsTableBody + "[" + j + "]" + "//tr//td[1]")).Text; String SkillLevelValue = GlobalDefinitions.driver.FindElement(By.XPath(SkillsTableBody + "[" + j + "]" + "//tr//td[2]")).Text; if (SkillValue == (GlobalDefinitions.ExcelLib.ReadData(4, "Skill")) && SkillLevelValue == (GlobalDefinitions.ExcelLib.ReadData(4, "SkillLevel"))) { //Clicking edit button of the skill needed to update GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", SkillsTableBody + "[" + j + "]" + "//tr[1]//td[3]//span[1]//i[1]", 4); GlobalDefinitions.driver.FindElement(By.XPath(SkillsTableBody + "[" + j + "]" + "//tr[1]//td[3]//span[1]//i[1]")).Click(); //Selecting the updated skill level SelectElement chooseLanguageLevel = new SelectElement(SkillsLevelDropdown); chooseLanguageLevel.SelectByValue(skillLevelToUpdate); //Clicking Update button GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", "//input[contains(@value,'Update')]", 4); updateButtonSkills.Click(); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Skills Updated"); Base.test.Log(LogStatus.Pass, "Skills updated successfully"); break; } } }
internal void EditShareSkillData() { //Calling wait method GenericWait.ElementExists(GlobalDefinitions.driver, "Name", "title", 8); //Clearing the "Title" Title.Clear(); //Entering the updated "Title" Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "Title")); //Validating Title GlobalDefinitions.TextDataFieldValidation("Title", GlobalDefinitions.ExcelLib.ReadData(2, "Title"), Title.GetAttribute("value")); //Clearing the "Description" Description.Clear(); //Entering the updated "Description" Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "Description")); //Validating Description GlobalDefinitions.TextDataFieldValidation("Description", GlobalDefinitions.ExcelLib.ReadData(4, "Description"), Description.Text); // Select the Service type radio button HelperCallingMethods.SelectingRadiobutton("//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", "serviceType", GlobalDefinitions.ExcelLib.ReadData(4, "ServiceType")); //Validating Service Type Radiobutton selection GlobalDefinitions.RadiobuttonValidation("ServiceTypeRadioButtons", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", "serviceType", GlobalDefinitions.ExcelLib.ReadData(4, "ServiceType")); // Select the Location type radio button HelperCallingMethods.SelectingRadiobutton("//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", "locationType", GlobalDefinitions.ExcelLib.ReadData(4, "LocationType")); //Validating Location Type Radiobutton selection GlobalDefinitions.RadiobuttonValidation("LocationTypeRadioButtons", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", "locationType", GlobalDefinitions.ExcelLib.ReadData(4, "LocationType")); }
public void SelectAvailabilityType() { GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//strong[text()='Availability']/../..//*[@class='right floated outline small write icon']", 5); Thread.Sleep(2000); string AvailabilityTypeValue = GlobalDefinitions.ExcelLib.ReadData(2, "Availability Type"); if (AvailabilityTypeValue == "Full Time") { GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//strong[text()='Availability']/../..//*[@class='right floated outline small write icon']", 5); AvailabilityTypeEditButton.Click(); HelperCallingMethods.SelectingDropdown(AvailabilityType, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "Availabilty Type")); //Validate message GlobalDefinitions.MessageValidation("Availability updated"); Thread.Sleep(2000); } else if (AvailabilityTypeValue == "Part Time") { GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//strong[text()='Availability']/../..//*[@class='right floated outline small write icon']", 5); AvailabilityTypeEditButton.Click(); HelperCallingMethods.SelectingDropdown(AvailabilityType, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "Availability Type")); //Validate message GlobalDefinitions.MessageValidation("Availability updated"); Thread.Sleep(2000); } }
internal void DeleteShareSkill(string CategoryToFind, string TitleToFind, string DescriptionToFind) { GenericWait.ElementIsVisible(GlobalDefinitions.driver, "LinkText", "Manage Listings", 8); //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.LinkText("Manage Listings"), 10); manageListingsLink.Click(); Thread.Sleep(2000); //Loop for searching the record through the pages for (int i = 0; i < paginationButtons.Count - 2; i++) { Thread.Sleep(2000); foreach (IWebElement listingRecord in tableRows) { string Category = listingRecord.FindElement(By.XPath("td[2]")).Text; string Title = listingRecord.FindElement(By.XPath("td[3]")).Text; string Description = listingRecord.FindElement(By.XPath("td[4]")).Text; //Comparing Category,title,description to find out corresponding delete button and deleting item if (Category.ToLower() == CategoryToFind.ToLower() && Title.ToLower() == TitleToFind.ToLower() && Description.ToLower().Contains(TitleToFind.ToLower())) { int rowToBeDeleted = tableRows.IndexOf(listingRecord) + 1; Thread.Sleep(3000); listingRecord.FindElement(By.XPath("//tr[" + rowToBeDeleted + "]/td[8]/div/button[3]/i")).Click(); Thread.Sleep(3000); //Clicking on "Yes" button from the delete popup deletePopupYesButton.Click(); //Validating deleted share skill ManageListings manageListings = new ManageListings(); int MatchingRecordFoundAfterAdding = manageListings.SearchListings(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "Title"), GlobalDefinitions.ExcelLib.ReadData(2, "Description")); try { if (MatchingRecordFoundAfterAdding < 1) { Base.test.Log(LogStatus.Pass, "Share Skill deleted successfully"); Assert.IsTrue(true); } else { Base.test.Log(LogStatus.Fail, "Share Skill deletion is unsuccessful" + " " + "Screenshot Image " + GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "ShareSkillScreenshot")); } } catch (Exception e) { Base.test.Log(LogStatus.Fail, "Share Skill deletion is unsuccessful", e.Message); } return; } } if (nextButton.Enabled == true) { nextButton.Click(); } } }
internal void ClickShareSkillButton() { //Wait for ShareSkill Button GenericWait.ElementIsVisible(GlobalDefinitions.driver, "LinkText", "Share Skill", 6); //Click ShareSkill Button ShareSkillButton.Click(); }
//Getting the total count of the All Categories public string GetAllCategoryTotal() { GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//a[@class='active item']", 6); Thread.Sleep(2000); string totalCategoryCount = null; //Check AllCategory is active and the total are changing if (AllCategory.Displayed && AllCategory.Enabled) { var span = AllCategory.FindElement(By.XPath(".//span")); totalCategoryCount = span.Text; } return(totalCategoryCount); }
public void SelectAvailabilityHour() { //GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPathAddShareSkill, "Availability"); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//strong[text()='Hours']/../..//*[@class='right floated outline small write icon']", 5); string AvailabilityHourValue = GlobalDefinitions.ExcelLib.ReadData(2, "Availability Hour"); if (AvailabilityHourValue == "Less than 30hours a week") { GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//strong[text()='Hours']/../..//*[@class='right floated outline small write icon']", 5); AvailabilityHourEditButton.Click(); HelperCallingMethods.SelectingDropdown(AvailabilityHour, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "Availability Hour")); //Validate message GlobalDefinitions.MessageValidation("Availability updated"); Thread.Sleep(2000); } else if (AvailabilityHourValue == "More than 30hours a week") { GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//strong[text()='Hours']/../..//*[@class='right floated outline small write icon']", 5); AvailabilityHourEditButton.Click(); HelperCallingMethods.SelectingDropdown(AvailabilityHour, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "Availability Hour")); //Validate message GlobalDefinitions.MessageValidation("Availability updated"); Thread.Sleep(2000); } else if (AvailabilityHourValue == "As needed") { GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//strong[text()='Hours']/../..//*[@class='right floated outline small write icon']", 5); AvailabilityHourEditButton.Click(); HelperCallingMethods.SelectingDropdown(AvailabilityHour, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "Availabilty Hour")); //Validate message GlobalDefinitions.MessageValidation("Availability updated"); Thread.Sleep(2000); } }
public void DeleteEducation() { //Reading from the excel about the education details to delete String countryToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "CountryToDelete"); String titleToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "TitleToDelete"); String yearToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "YearToDelete"); for (int j = 1; j <= educationRecords.Count; j++) { //Searching the education details to delete String countryValue = GlobalDefinitions.driver.FindElement(By.XPath(educationTableBody + "[" + j + "]" + "//tr//td[1]")).Text; String titleValue = GlobalDefinitions.driver.FindElement(By.XPath(educationTableBody + "[" + j + "]" + "//tr//td[3]")).Text; String yearValue = GlobalDefinitions.driver.FindElement(By.XPath(educationTableBody + "[" + j + "]" + "//tr//td[5]")).Text; try { if (countryValue == countryToDelete && titleValue == titleToDelete && yearValue == yearToDelete) { //Deleting the particular education detail GlobalDefinitions.driver.FindElement(By.XPath(educationTableBody + "[" + j + "]" + "/tr/td[6]/span[2]/i")).Click(); Thread.Sleep(3000); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "ClassName", "ns-box-inner", 7); String DeleteAlertPopupText = GlobalDefinitions.driver.FindElement(By.ClassName("ns-box-inner")).Text; Assert.IsTrue(DeleteAlertPopupText.Contains("removed")); Base.test.Log(LogStatus.Pass, "Education details deleted from the list"); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Education details deleted"); break; } } catch (Exception e) { Assert.Fail("Education details failed to delete", e.Message); Base.test.Log(LogStatus.Fail, "Unable to delete the education details from the list", e.Message); } } }
public void DeleteCertification() { //Reading from the excel about the certification details to delete String CertificationNameToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "CertificationNameToDelete"); String CertifiedFromToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "CertifiedFromToDelete"); //String yearToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "YearToDelete"); for (int j = 1; j <= certificationRecords.Count; j++) { //String countryValue = GlobalDefinitions.driver.FindElement(By.XPath(educationTableBody + "[" + j + "]" + "//tr//td[1]")).Text; String certificateNameValue = GlobalDefinitions.driver.FindElement(By.XPath(certificationTableBody + "[" + j + "]" + "//tr//td[1]")).Text; String certificationFromValue = GlobalDefinitions.driver.FindElement(By.XPath(certificationTableBody + "[" + j + "]" + "//tr//td[2]")).Text; //String yearValue = GlobalDefinitions.driver.FindElement(By.XPath(certificationTableBody + "[" + j + "]" + "//tr//td[3]")).Text; try { if (certificateNameValue == CertificationNameToDelete && certificationFromValue == CertifiedFromToDelete) { //Deleting the particular certication detail GlobalDefinitions.driver.FindElement(By.XPath(certificationTableBody + "[" + j + "]" + "/tr[1]/td[4]/span[2]/i[1]")).Click(); Thread.Sleep(3000); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "ClassName", "ns-box-inner", 7); String DeleteAlertPopupText = GlobalDefinitions.driver.FindElement(By.ClassName("ns-box-inner")).Text; Assert.IsTrue(DeleteAlertPopupText.Contains("deleted"), CertificationNameToDelete + " " + "has been deleted from the list"); Base.test.Log(LogStatus.Pass, "Certification details deleted from the list"); break; } } catch (Exception e) { Assert.IsFalse(false, "Exception Thrown, Exception: " + " " + e.ToString()); Base.test.Log(LogStatus.Fail, "Unable to delete the education details from the list", e.Message); } } }
// internal void ChangePassword() { //Retrieving new password, confirm password and current passowrd value from excel GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ChangePassword"); String CurrentPasswordValue = GlobalDefinitions.ExcelLib.ReadData(2, "Password"); String NewPasswordValue = GlobalDefinitions.ExcelLib.ReadData(2, "NewPassword"); String ConfirmPasswordValue = GlobalDefinitions.ExcelLib.ReadData(2, "ConfirmPassword"); //Moving curser to Userwelcom link Actions actions = new Actions(GlobalDefinitions.driver); Thread.Sleep(4000); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "Xpath", "//span[contains(@class,'item ui dropdown link')]", 3); actions.MoveToElement(UserWelcomeLink).Build().Perform(); //Clicking on the change password link GenericWait.ElementIsClickable(GlobalDefinitions.driver, "LinkText", "Change Password", 3); Thread.Sleep(2000); ChangePasswordLink.Click(); //Entering the current password CurrentPasswordTextbox.SendKeys(CurrentPasswordValue); //Entering the new password NewPasswordTextbox.SendKeys(NewPasswordValue); //Entering the confirm password ConfirmPasswordTextbox.SendKeys(ConfirmPasswordValue); //clicking on the save button SaveButton.Click(); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Change Password"); //Validating message GlobalDefinitions.MessageValidation("Password Changed Successfully"); }
internal int SearchListings(string CategoryToSearch, string TitleToSearch, string DescriptionToSearch) { //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.LinkText("Manage Listings"), 5); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "LinkText", "Manage Listings", 6); //Navigate to Manage Listing page manageListingsLink.Click(); //Initialize the Record count to 0 int RecordFound = 0; GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//div[@id='listing-management-section']/div/div[1]/div[1]", 6); //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//div[@id='listing-management-section']/div/div[1]/div[1]"), 5); //Loop for searching record through the pages for (int i = 0; i < paginationButtons.Count - 2; i++) { Thread.Sleep(2000); foreach (IWebElement listingRecord in tableRows) { string Category = listingRecord.FindElement(By.XPath("td[2]")).Text; string Title = listingRecord.FindElement(By.XPath("td[3]")).Text; string Description = listingRecord.FindElement(By.XPath("td[4]")).Text; if (Category == CategoryToSearch && Title == TitleToSearch && Description == DescriptionToSearch) { RecordFound++; } } // It will navigate to next page if the next button is enabled if (nextButton.Enabled == true) { nextButton.Click(); } } // Returning the no. of matching record found return(RecordFound); }
public void UpdateAddedLanguage() { //for (int i = 1; i <= NumberOfLanguagesToAdd; i++) //{ //Reading language and updated language level from the excel String languageToUpdate = GlobalDefinitions.ExcelLib.ReadData(2, "LanguageToUpdate"); String languageLevelToUpdate = GlobalDefinitions.ExcelLib.ReadData(2, "LanguageLevelToUpdate"); //Searching through the Language list to find a language need to be updated for (int j = 1; j <= LanguageRecords.Count; j++) { String LanguageValue = GlobalDefinitions.driver.FindElement(By.XPath(LanguageBody + "[" + j + "]" + "//tr//td[1]")).Text; String LanguageLevelValue = GlobalDefinitions.driver.FindElement(By.XPath(LanguageBody + "[" + j + "]" + "//tr//td[2]")).Text; if (LanguageValue == (GlobalDefinitions.ExcelLib.ReadData(3, "Language")) && LanguageLevelValue == (GlobalDefinitions.ExcelLib.ReadData(3, "LanguageLevel"))) { GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", "//tbody" + "[" + j + "]//tr[1]//td[3]//span[1]//i[1]", 3); //Clicking edit button of the language needed to update GlobalDefinitions.driver.FindElement(By.XPath("//tbody" + "[" + j + "]//tr[1]//td[3]//span[1]//i[1]")).Click(); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "Name", "level", 6); //Selecting the updated language level SelectElement chooseLanguageLevel = new SelectElement(LanguageLevelDropdown); chooseLanguageLevel.SelectByValue(languageLevelToUpdate); GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", "//input[contains(@value,'Update')]", 6); //Clicking Update button updateButtonLanguage.Click(); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Update Language"); break; } } }
//Validate password has been changed public void ValidateChangedPassword() { try { GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "SignIn"); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//button[text()='Sign Out']", 6); //Click on the signout button SignOutBtn.Click(); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//a[contains(text(),'Sign')]", 6); //Clicking on SignIn link SignInLink.Click(); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "Name", "email", 6); //Enter the username Email.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Username")); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "Name", "password", 6); //Enter the new password Password.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "New Password")); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//button[contains(text(),'Login')]", 6); //Click on the Login button LoginBtn.Click(); //Validating user succesfully login after with the changed password GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//div[@class ='ui compact menu']//span[@class = 'item ui dropdown link '][contains(text(),'Hi')]", 6); if (UserWelcomeLink.Displayed) { Assert.IsTrue(true); Base.test.Log(LogStatus.Pass, "User new password has been changed successfully"); } else { Assert.IsTrue(false, "User new password has failed to update"); Base.test.Log(LogStatus.Fail, "User new password has failed to update"); } } catch (Exception e) { Base.test.Log(LogStatus.Fail, "Exception found For Change Password", e.Message); } /*Resetting the password*/ //Retreiving passwords values from the excel GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ChangePassword"); String CurrentPasswordValue = GlobalDefinitions.ExcelLib.ReadData(2, "NewPassword"); String NewPasswordValue = GlobalDefinitions.ExcelLib.ReadData(2, "Password"); String ConfirmPasswordValue = GlobalDefinitions.ExcelLib.ReadData(2, "Password"); //Clicking on User welcome name link UserWelcomeLink.Click(); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "LinkText", "Change Password", 5); //Clicking on change password link ChangePasswordLink.Click(); //Entering the current password CurrentPasswordTextbox.SendKeys(CurrentPasswordValue); //Entering the new password password NewPasswordTextbox.SendKeys(NewPasswordValue); //Entering the confirm password ConfirmPasswordTextbox.SendKeys(ConfirmPasswordValue); //Clicking on the save button SaveButton.Click(); }
internal void EditShareSkill(string CategoryToSearch, string TitleToSearch, string DescriptionToSearch) { GenericWait.ElementIsVisible(GlobalDefinitions.driver, "LinkText", "Manage Listings", 8); //Navigate to Manage Listing page manageListingsLink.Click(); int RecordFound = 0; GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//div[@id='listing-management-section']/div/div[1]/div[1]", 8); // GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//div[@id='listing-management-section']/div/div[1]/div[1]"), 5); Thread.Sleep(2000); // Searching for the added share skill record in the Manage Listing and validating is it available or not for (int i = 0; i < paginationButtons.Count - 2; i++) { Thread.Sleep(2000); //Loop for searching the added share skill through the pages foreach (IWebElement listingRecord in tableRows) { string Category = listingRecord.FindElement(By.XPath("td[2]")).Text; string Title = listingRecord.FindElement(By.XPath("td[3]")).Text; string Description = listingRecord.FindElement(By.XPath("td[4]")).Text; //Comparing Category,title,description to find out corresponding Edit button and Editing item if (Category == CategoryToSearch && Title == TitleToSearch && Description == DescriptionToSearch) { //Editing a matched record int rowToBeEdited = tableRows.IndexOf(listingRecord) + 1; listingRecord.FindElement(By.XPath("//tr[" + rowToBeEdited + "]/td[8]/div/button[2]/i")).Click(); Thread.Sleep(2000); //log after editing Base.test.Log(LogStatus.Pass, "Share skill with titlename" + " " + Title + " " + "edit button is clicked and navigated to Edit share skill page"); RecordFound++; GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPathAddShareSkill, "EditShareSkill"); //Calling EnterShareSkill() for adding share skill data ShareSkill shareSkill = new ShareSkill(); //shareSkill.EnterShareSkill(); shareSkill.EditShareSkillData(); Thread.Sleep(2000); //Clicking Save button Save.Click(); //Validating edited record int MatchingRecordFoundAfterAdding = SearchListings(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "Title"), GlobalDefinitions.ExcelLib.ReadData(2, "Description")); int ExpectedRecords = MatchingRecordFoundAfterAdding + 1; try { if (MatchingRecordFoundAfterAdding > 0) { Base.test.Log(LogStatus.Pass, "Edited and saved a Share Skill Successfully"); Assert.IsTrue(true); } else { Base.test.Log(LogStatus.Fail, "Edit and adding a Share Skill is unsuccessful" + " " + "Screenshot Image " + GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "ShareSkillScreenshot")); } } catch (Exception e) { Base.test.Log(LogStatus.Fail, "Edit and adding a Share Skill is unsuccessful", e.Message); } return; } } if (nextButton.Enabled == true) { nextButton.Click(); } } }
public void NavigateToSkillsTab() { GenericWait.ElementIsClickable(GlobalDefinitions.driver, "XPath", "//a[contains(text(),'Skills')]", 2); SkillsTab.Click(); }
internal void EnterShareSkill() { //Calling wait method GenericWait.ElementExists(GlobalDefinitions.driver, "Name", "title", 8); //Entering the "Title" Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Validating Title GlobalDefinitions.TextDataFieldValidation("Title", GlobalDefinitions.ExcelLib.ReadData(2, "Title"), Title.GetAttribute("value")); //Entering the "Description" Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Validating Description GlobalDefinitions.TextDataFieldValidation("Description", GlobalDefinitions.ExcelLib.ReadData(2, "Description"), Description.Text); //Selecting Category HelperCallingMethods.SelectingDropdown(CategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Validating Category selection GlobalDefinitions.DropDownDataValidation("Category", CategoryDropDown, GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Selecting Sub-Category HelperCallingMethods.SelectingDropdown(SubCategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Validating Sub-Category selection GlobalDefinitions.DropDownDataValidation("SubCategory", SubCategoryDropDown, GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Entering Tag Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n"); //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//span[@class='ReactTags__tag']"), 5); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//span[@class='ReactTags__tag']", 6); string EnteredTagTxt = TagReact.Text; //Validating entered Tag GlobalDefinitions.TextDataFieldValidation("Tags", GlobalDefinitions.ExcelLib.ReadData(2, "Tags"), EnteredTagTxt.Remove(EnteredTagTxt.Length - 1, 1)); // Select the Service type radio button HelperCallingMethods.SelectingRadiobutton("//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", "serviceType", GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType")); //Validating Service Type Radiobutton selection GlobalDefinitions.RadiobuttonValidation("ServiceTypeRadioButtons", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", "serviceType", GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType")); // Select the Location type radio button HelperCallingMethods.SelectingRadiobutton("//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", "locationType", GlobalDefinitions.ExcelLib.ReadData(2, "LocationType")); //Validating Location Type Radiobutton selection GlobalDefinitions.RadiobuttonValidation("LocationTypeRadioButtons", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", "locationType", GlobalDefinitions.ExcelLib.ReadData(2, "LocationType")); //Selecting date and time HelperCallingMethods helperCallingMethods = new HelperCallingMethods(); helperCallingMethods.SelectingDateAndTime(); //Validating Start Date, End Date, Start Time,End Time GlobalDefinitions.TextDataFieldValidation("Start Date", DateTime.Today.ToString("dd/MM/yyyy"), DateTime.Parse(StartDateDropDown.GetAttribute("value")).ToString("dd/MM/yyyy")); GlobalDefinitions.TextDataFieldValidation("End Date", DateTime.Today.AddDays(14).ToString("dd/MM/yyyy"), DateTime.Parse(EndDateDropDown.GetAttribute("value")).ToString("dd/MM/yyyy")); GlobalDefinitions.TextDataFieldValidation("Start Time", GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"), DateTime.Parse(StartTime.GetAttribute("value")).ToString("hh:mmtt")); GlobalDefinitions.TextDataFieldValidation("End Time", GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"), DateTime.Parse(EndTime.GetAttribute("value")).ToString("hh:mmtt")); //Selecting SkillTrade or Credit radio button HelperCallingMethods.SelectingRadiobutton("//form/div[8]/div[@class='twelve wide column']/div/div[@class = 'field']", "skillTrades", GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade")); string SkillTradeValue = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"); //Enter Skill-Exchange or Credit if (SkillTradeValue == "Skill-exchange") { SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + "\n"); //Validating entered Skill exchange value GlobalDefinitions.TextDataFieldValidation("SkillExchange", GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"), SkillExchangeTag.Text.Remove(SkillExchangeTag.Text.Length - 1, 1)); } else if (SkillTradeValue == "Credit") { CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); //Validating entered Credit value GlobalDefinitions.TextDataFieldValidation("Credit", GlobalDefinitions.ExcelLib.ReadData(2, "Credit"), CreditAmount.GetAttribute("value")); } //Uploading file for Work Sample WorkSamples.Click(); AutoItX3 autoIt = new AutoItX3(); autoIt.WinWait("Open", "File Upload", 1); autoIt.WinActivate("Open", "File Upload"); autoIt.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]"); autoIt.Sleep(1000); //autoIt.Send(Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory()) + "\\FileUploadTest.txt")); autoIt.Send(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\FileUploadTest.txt")); autoIt.Sleep(1000); autoIt.Send("{ENTER}"); autoIt.Sleep(2000); string[] FileSplitText = WorkSampleFileName.Text.Split('.'); string FileSplitTextName = FileSplitText[0]; //Validating uploaded worksample GlobalDefinitions.TextDataFieldValidation("WorkSamples", FileSplitTextName.ToString(), GlobalDefinitions.ExcelLib.ReadData(2, "FileName").ToString()); //selecting Active radio button HelperCallingMethods.SelectingRadiobutton("//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", "isActive", GlobalDefinitions.ExcelLib.ReadData(2, "Active")); //Validating Active radio button selection GlobalDefinitions.RadiobuttonValidation("Active", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", "isActive", GlobalDefinitions.ExcelLib.ReadData(2, "Active")); //Clicking Save button Save.Click(); string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Share skill added"); }
//Entering the skill in search skill textbox and searching public void EnterSkillIntoSearchBox(string SearchTerm) { GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//input[contains(@placeholder,'Search skills')][1]", 5); SearchSkillsTextbox.SendKeys(SearchTerm + "\n"); }
public void EnterSkillIntoFilterSearchBox(string SearchTerm) { Thread.Sleep(2000); GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//section[@class='search-results']/descendant::div[@class='four wide column']/descendant::input[@placeholder='Search skills']", 5); FilterSearchSkillsTextbox.SendKeys(SearchTerm + "\n"); }
//Retrieving the Year value to update from excel //private string yearToUpdate => GlobalDefinitions.ExcelLib.ReadData(2, "YearToUpdate"); public void NavigateToCertificationPage() { // Clicking on the Education tab GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//a[@class='item'][contains(.,'Certifications')]", 3); certificationTab.Click(); }