public void AddCertifications() { PopulateDataForTabs(); //click on certification tab // Base.driver.WaitForClickableElement(By.XPath("//a[@class='item'][contains(text(),'Certifications')]")); // tabCertifications.Click(); //click on Addnew Base.driver.WaitForClickableElement(By.XPath("//div[@id='account-profile-section']/descendant::section[2]/child::div/descendant::div[2]/child::div[3]/form/child::div[5]/descendant::div[5]/div/table/thead/tr[1]/th[4]/div")); btnAddNewCetification.Click(); //Certificate textbox Base.driver.WaitForElement(By.XPath("//input[@name='certificationName']")); txtCertificate.SendKeys(ExcelLibrary.ReadData(2, "Certificate")); //certified from textbox Base.driver.WaitForElement(By.XPath("//input[@name='certificationFrom']")); txtCertified.SendKeys(ExcelLibrary.ReadData(2, "Certified from")); //year dropdown Base.driver.WaitForElement(By.XPath("//select[@name='certificationYear']")); SelectElement YearDropdown = new SelectElement(dropdownYearCertified); YearDropdown.SelectByValue(ExcelLibrary.ReadData(2, "Year")); //click on add Base.driver.WaitForClickableElement(By.XPath("//div[@class='five wide field']/input[1]")); btnAddCertification.Click(); }
public void StudentHomeTest() { SetDriver(); Thread.Sleep(5000); driver.Manage().Window.Maximize(); logger.Info("Lanch"); Thread.Sleep(5000); driver.Navigate().GoToUrl(appUrl2); ExcelLibrary.PopulateInCollection(excelPath, sheetName); string fNameData = ExcelLibrary.ReadData(1, "FirstName"); string lNameData = ExcelLibrary.ReadData(1, "LName"); IWebElement firstName = driver.FindElement(By.Id(StudentPageLocator.firstNameIdLocator)); firstName.Click(); logger.Info("Entering the FirstName"); firstName.SendKeys(fNameData); IWebElement LastName = driver.FindElement(By.Id(StudentPageLocator.firstNameIdLocator)); LastName.Click(); logger.Info("Enterign the LastName"); LastName.SendKeys(lNameData); ((ITakesScreenshot)driver).GetScreenshot().SaveAsFile("StudentHomeTest.png", ScreenshotImageFormat.Png); }
public void UUTestPractice_Students_Form() { ExcelLibrary.PopulateInCollection(excelPath, sheetName); string fNameData = ExcelLibrary.ReadData(1, "FirstName"); string lNameData = ExcelLibrary.ReadData(1, "LName"); Thread.Sleep(5000); logger.Info("Entering the FirstName"); wrapperFunctions.EnterTextbyLocator("id", StudentPageLocator.firstNameIdLocator, fNameData); logger.Info(" Entering the LastName"); wrapperFunctions.EnterTextbyLocator("id", StudentPageLocator.lastNameIdLocator, lNameData); wrapperFunctions.ClickElement("xpath", "/html/body/div[1]/div/div[2]/ul/li[8]/a"); bool checkoxStatus = wrapperFunctions.SelectingCheckBox_RadioButton("xpath", "/html/body/div[2]/div[1]/div/form/div[4]/label[4]/input", "cricket"); Assert.True(checkoxStatus, "Cricket Checkbox is checked"); bool singleRadioButton = wrapperFunctions.SelectingCheckBox_RadioButton("xpath", "/html/body/div[2]/div[1]/div/form/div[3]/label[3]/input", "Single"); Assert.True(singleRadioButton, "Single Radiobutton is clicked"); string dropdowntext = wrapperFunctions.DropdownSelectByText("id", "sel1", "Canada"); if (dropdowntext == "Canda") { logger.Info("Canada dropdown selected succesfully"); } else { logger.Error("Canada dropdown not selected succesfully"); Assert.Fail(); } }
//this method registers new user into website public void Register() { ExcelLibrary.PopulateInCollection(Base.TestDataPath, "Registration"); //click on Join button to register Join.Click(); //enter first name txtFirstName.SendKeys(ExcelLibrary.ReadData(2, "FirstName")); //enter last name txtLastName.SendKeys(ExcelLibrary.ReadData(2, "LastName")); //enter email address txtEmailAddress.SendKeys(ExcelLibrary.ReadData(2, "Emailaddress")); //enter password txtPassword.SendKeys(ExcelLibrary.ReadData(2, "Password")); //enter confirm password txtConfirmPassword.SendKeys(ExcelLibrary.ReadData(2, "ConfirmPassword")); //keyword //check terms and conditions if (ExcelLibrary.ReadData(2, "I agree to Terms and Conditions") == "check") { checkboxTermsConditions.Click(); } //click on join button to register if (ExcelLibrary.ReadData(2, "Join") == "join") { btnJoin.Click(); } }
public void UpdateCeritfications() { PopulateDataForTabs(); //click on certification tab //Base.driver.WaitForClickableElement(By.XPath("//a[@class='item'][contains(text(),'Certifications')]")); //tabCertifications.Click(); //click on Edit button Base.driver.WaitForClickableElement(By.XPath("//div[@class='twelve wide column scrollTable']/div/table/tbody/tr[1]/td[4]/span[1]/i")); btnEditCertification.Click(); //Certificate textbox Base.driver.WaitForElement(By.XPath("//input[@name='certificationName']")); txtCertificate.Clear(); txtCertificate.SendKeys(ExcelLibrary.ReadData(3, "Certificate")); //certified from textbox Base.driver.WaitForElement(By.XPath("//input[@name='certificationFrom']")); txtCertified.Clear(); txtCertified.SendKeys(ExcelLibrary.ReadData(3, "Certified from")); //year dropdown Base.driver.WaitForElement(By.XPath("//select[@name='certificationYear']")); SelectElement YearDropdown = new SelectElement(dropdownYearCertified); YearDropdown.SelectByValue(ExcelLibrary.ReadData(3, "Year")); //click on Update Base.driver.WaitForElement(By.XPath("//input[@value='Update']")); btnUpdateCertification.Click(); }
//Slecting Available days public void SelectAvailaibleDayAndTime() { int WeekDaysSize = WeekDays.Count(); for (int i = 0; i < WeekDaysSize; i++) { String dayOfWeek = WeekDaysName.ElementAt(i).Text; if (dayOfWeek == ExcelLibrary.ReadData(2, "Selectday")) { Thread.Sleep(1000); WeekDays.ElementAt(i).Click(); Thread.Sleep(1000); string str = ExcelLibrary.ReadData(2, "Starttime"); //Console.WriteLine(str); DateTime dt = DateTime.Parse(str); Console.WriteLine(dt.ToLongTimeString().ToString()); StartTime.ElementAt(i).SendKeys(dt.ToLongTimeString().ToString()); Thread.Sleep(1000); string str1 = ExcelLibrary.ReadData(2, "Endtime"); DateTime dt1 = DateTime.Parse(str1); EndTime.ElementAt(i).SendKeys(dt1.ToString("hh:mm tt")); //12/31/1899 6:00:00 AM } } }
public void UpdateSkills() { PopulateDataForTabs(); //click on skills tab // Base.driver.WaitForElement(By.XPath("//a[@class='item'][contains(text(),'Skills')]")); // tabSkills.Click(); //edit buttonbutton Base.driver.WaitForElement(By.XPath("//div[@class='ui bottom attached tab segment tooltip-target active']/descendant::div[@class='form-wrapper']/table/tbody/tr[1]/td[3]/span[1]/i")); btnEditSkill.Click(); //add skills textbox Base.driver.WaitForElement(By.XPath("//input[@placeholder='Add Skill']")); txtSkills.Clear(); txtSkills.SendKeys(ExcelLibrary.ReadData(3, "Skills")); //slecting skilll level Base.driver.WaitForElement(By.XPath("//Select[@name='level']")); SelectElement skillLeveldropdown = new SelectElement(dropdownSkillsLevel); skillLeveldropdown.SelectByText(ExcelLibrary.ReadData(3, "Skill level")); //click update button Base.driver.WaitForClickableElement(By.XPath("//input[@value='Update']")); btnUpdateSkill.Click(); }
//This method deletes ManageLIsting fom ManageListings table public void DeleteManageListing() { ExcelLibrary.PopulateInCollection(Base.TestDataPath, "ManageListingsSheet"); Base.driver.WaitForElement(By.XPath("//tbody/tr[1]/td[3]")); String titleManageListing = Base.driver.FindElement(By.XPath("//tbody/tr[1]/td[3]")).Text; if ((ExcelLibrary.ReadData(2, "Delete Action")) == "Yes") { if ((titleManageListing == "Seleinium with Csharp") || (titleManageListing == "Seleinium with Java")) // if (titleManageListing == "Java") { btnDelete.Click(); Thread.Sleep(1000); String deleteText = Base.driver.FindElement(By.XPath("/html/body/div[2]/div/div[2]/p[1]")).Text; String deleteByTitle = Base.driver.FindElement(By.XPath("/html/body/div[2]/div/div[2]/p[2]")).Text; if ((deleteText == "Are you sure you want to delete this service?") && (deleteByTitle == titleManageListing)) { //click on 'Yes' to delete ManageListing Base.driver.FindElement(By.XPath("//div[@class='actions']/button[2]")).Click(); } else { //click on 'No' to cancel delete ManageListing Base.driver.FindElement(By.XPath("//div[@class='actions']/button[1]")).Click(); } } } }
public void AddSkills() { PopulateDataForTabs(); //click on skills tab // Base.driver.WaitForClickableElement(By.XPath("//a[@class='item'][contains(text(),'Skills')]")); //tabSkills.Click(); //add new button btnAddNewSkills.Click(); //add skills textbox Base.driver.WaitForElement(By.XPath("//input[@placeholder='Add Skill']")); txtSkills.SendKeys(ExcelLibrary.ReadData(2, "Skills")); //slecting skilll level Base.driver.WaitForElement(By.XPath("//Select[@name='level']")); SelectElement skillLeveldropdown = new SelectElement(dropdownSkillsLevel); skillLeveldropdown.SelectByText(ExcelLibrary.ReadData(2, "Skill level")); //click add button btnAddSkill.Click(); }
//This method is used to search skill by filter type in serch text box and in search result page public void SearchByFilterType() { PopulateDataForSearchSkill(); ProfilePage profile = new ProfilePage(); profile.ClickShareSkill(); // click on SearchSkill textbox Base.driver.WaitForElement(By.XPath("//div[@class='ui small icon input search-box']/input")); txtSearchSkill.Click(); txtSearchSkill.SendKeys(ExcelLibrary.ReadData(2, "Filter")); //click on search icon Base.driver.WaitForElement(By.XPath("//div[@class='ui small icon input search-box']/i")); btnSearchIcon.Click(); Base.driver.WaitForClickableElement(By.XPath("//div[@class='ui buttons']/button")); int listFilter = Filter.Count(); for (int i = 0; i < listFilter; i++) { String txtFilter = Filter.ElementAt(i).Text; if (txtFilter == ExcelLibrary.ReadData(4, "Filter")) { Thread.Sleep(10000); Filter.ElementAt(i).Click(); } } }
public void UpdateAvailability() { PopulateValues(); Base.driver.WaitForClickableElement(By.XPath("//div[@class='extra content']/descendant::div[5]/span/i")); Base.driver.WaitForElement(By.XPath("//select[@name='availabiltyType']")); SelectElement availabiltyDropdown = new SelectElement(dropdownAvailability); availabiltyDropdown.SelectByText(ExcelLibrary.ReadData(3, "Availability")); }
public void AddEarnTarget() { PopulateValues(); // EarnTarget.Click(); Base.driver.WaitForElement(By.XPath("//select[@name='availabiltyTarget']")); SelectElement earnTargetDropdown = new SelectElement(dropdownEarnTarget); earnTargetDropdown.SelectByText(ExcelLibrary.ReadData(2, "Earn Target")); }
public void AddHours() { PopulateValues(); //Hours.Click(); Base.driver.WaitForElement(By.XPath("//div[@class='right floated content'] /span/select")); SelectElement HoursDropdown = new SelectElement(dropdownHours); HoursDropdown.SelectByText(ExcelLibrary.ReadData(2, "Hours")); }
public void AddAvailability() { PopulateValues(); Base.driver.WaitForElement(By.XPath("//select[@name='availabiltyType']")); SelectElement availabiltyDropdown = new SelectElement(dropdownAvailability); availabiltyDropdown.SelectByText(ExcelLibrary.ReadData(2, "Availability")); }
public void UpdateEarnTarget() { PopulateValues(); //Base.driver.WaitForClickableElement(By.XPath("//div[@class='extra content']/descendant::div[8]/div[@class='right floated content']/span/i")); //EarnTarget.Click(); Base.driver.WaitForClickableElement(By.XPath("//select[@name='availabiltyTarget']")); SelectElement earnTargetDropdown = new SelectElement(dropdownEarnTarget); earnTargetDropdown.SelectByText(ExcelLibrary.ReadData(3, "Earn Target")); }
public void UpdateHours() { PopulateValues(); //Base.driver.WaitForClickableElement(By.XPath("//div[@class='extra content']/descendant::div[6]/div[@class='right floated content']/span/i")); //Hours.Click(); Base.driver.WaitForClickableElement(By.XPath("//select[@name='availabiltyHour']")); SelectElement HoursDropdown = new SelectElement(dropdownHours); HoursDropdown.SelectByText(ExcelLibrary.ReadData(3, "Hours")); }
public void AddDescription() { PopulateValues(); Base.driver.WaitForClickableElement(By.XPath("//div[@class='eight wide column']/descendant::div[3]/h3/span/i")); //Desription.Click(); txtDescription.Clear(); txtDescription.SendKeys(ExcelLibrary.ReadData(2, "Description")); Base.driver.WaitForClickableElement(By.XPath("/html/body/div[1]/div/section[2]/div/div/div/div[3]/div/div/form/div/div/div[2]/button")); btnSaveDescription.Click(); }
//subcategory public void SearchSkillBySubCategory() { PopulateDataForSearchSkill(); // click on SearchSkill textbox Base.driver.WaitForElement(By.XPath("//div[@class='ui small icon input search-box']/input")); txtSearchSkill.Click(); txtSearchSkill.SendKeys(ExcelLibrary.ReadData(2, "SubCategory")); //click on search icon Base.driver.WaitForElement(By.XPath("//div[@class='ui small icon input search-box']/i")); btnSearchIcon.Click(); }
public void ThenHoursIsSuccessfullyUpdated() { profile.PopulateValues(); Base.driver.WaitForElement(By.XPath("//div[@class='extra content']/descendant::div[6]/div[@class='right floated content']/span")); String HoursText = Base.driver.FindElement(By.XPath("//div[@class='extra content']/descendant::div[6]/div[@class='right floated content']/span")).Text; if (HoursText == "") { profile.AddHours(); } String HoursText2 = Base.driver.FindElement(By.XPath("//div[@class='extra content']/descendant::div[6]/div[@class='right floated content']/span")).Text; Assert.AreEqual((ExcelLibrary.ReadData(2, "Hours")), HoursText2); }
public void ThenEarnTargetIsSuccessfullySaved() { profile.PopulateValues(); Base.driver.WaitForElement(By.XPath("//div[@class='extra content']/descendant::div[8]/div[@class='right floated content']/span")); String EarnTargetText = Base.driver.FindElement(By.XPath("//div[@class='extra content']/descendant::div[8]/div[@class='right floated content']/span")).Text; if (EarnTargetText == "") { profile.AddEarnTarget(); } String EarnTargetText2 = Base.driver.FindElement(By.XPath("//div[@class='extra content']/descendant::div[8]/div[@class='right floated content']/span")).Text; Assert.AreEqual((ExcelLibrary.ReadData(2, "Earn Target")), EarnTargetText2); }
//This method selects ServiceType based on data from excelsheet public void ActiveSelection() { int listSize = radioActive.Count(); for (int i = 0; i < listSize; i++) { String radioText = labelActive.ElementAt(i).Text; if (radioText == ExcelLibrary.ReadData(2, "Active")) { Thread.Sleep(10000); labelActive.ElementAt(i).Click(); } } }
//This method Edits ManageListing from ManageListings table public void EditManageListings() { ExcelLibrary.PopulateInCollection(Base.TestDataPath, "ManageListingsSheet"); if ((ExcelLibrary.ReadData(2, "Edit Action")) == "Yes") { Base.driver.WaitForElement(By.XPath("//tbody/tr[1]/td[3]")); String titleManageListing = Base.driver.FindElement(By.XPath("//tbody/tr[1]/td[3]")).Text; if (titleManageListing == "Seleinium with Csharp") { btnEdit.Click(); ShareSkillPage skillPage = new ShareSkillPage(); skillPage.ReadExcelEditShareSkill(); skillPage.AddShareSkill(); } } }
// Login method performs login operation with valid credentials public void LogIn() { //populating data from excel sheet into datacollectiion ExcelLibrary.PopulateInCollection(Base.TestDataPath, "LogInSheet"); //user clicks on SignIn button btnSignIn.Click(); //user enters valid username txtEmailAddress.SendKeys(ExcelLibrary.ReadData(2, "Email")); //user enters valid password txtPassword.SendKeys(ExcelLibrary.ReadData(2, "Password")); //user clicks on login button btnLogin.Click(); }
public void ChangePasswordDetails() { //enter old password Base.driver.WaitForElement(By.XPath("//input[@name='oldPassword']")); txtOldPassword.SendKeys(ExcelLibrary.ReadData(2, "Password")); //enter New password Base.driver.WaitForElement(By.XPath("//input[@name='newPassword']")); txtNewPassword.SendKeys(ExcelLibrary.ReadData(3, "Password")); //confirm password Base.driver.WaitForElement(By.XPath("//input[@name='confirmPassword']")); txtConfirmPassword.SendKeys(ExcelLibrary.ReadData(3, "ConfirmPassword")); //click on save Base.driver.WaitForClickableElement(By.XPath("/html/body/div[4]/div/div[2]/form/div[4]/button")); btnSave.Click(); }
public void UpdateEducation() { PopulateDataForTabs(); //click on education tab //Base.driver.WaitForClickableElement(By.XPath("//a[@class='item'][contains(text(),'Education')]")); //tabEducation.Click(); //click on edit button Base.driver.WaitForClickableElement(By.XPath("//div[@class='twelve wide column scrollTable']/div/table/tbody/tr[1]/td[6]/span[1]/i")); btnEditEducation.Click(); //college name textbox Base.driver.WaitForElement(By.XPath("//input[@name='instituteName']")); txtCollegeUni.Clear(); txtCollegeUni.SendKeys(ExcelLibrary.ReadData(3, "College Name")); //country dropdown Base.driver.WaitForElement(By.XPath("//select[@name='country']")); SelectElement CountryDropdown = new SelectElement(dropdownCollegeUni); CountryDropdown.SelectByValue(ExcelLibrary.ReadData(3, "Country of College")); //selecting title Base.driver.WaitForElement(By.XPath("//select[@name='title']")); SelectElement TitleDropdown = new SelectElement(dropdownTitle); TitleDropdown.SelectByValue(ExcelLibrary.ReadData(3, "Title")); //dgree textbox Base.driver.WaitForElement(By.XPath("//input[@name='degree']")); txtDegree.Clear(); txtDegree.SendKeys(ExcelLibrary.ReadData(3, "Degree")); //selecting year of graduation Base.driver.WaitForElement(By.XPath("//select[@name='yearOfGraduation']")); SelectElement YearDropdown = new SelectElement(dropdownYear); YearDropdown.SelectByValue(ExcelLibrary.ReadData(3, "Year of graduation")); //click on add to update education Base.driver.WaitForClickableElement(By.XPath("//input[@value='Update']")); btnUpdateEducation.Click(); }
public void AddLanguage() { PopulateDataForTabs(); //click on addnew // Base.driver.WaitForElement(By.XPath("//div[@id='account-profile-section']/descendant::section[2]/child::div/descendant::div[2]/child::div[3]/form/child::div[2]/descendant::div[6]/table/thead/tr/th[3]/div")); // btnLangAddNew.Click(); //enter language in language textbox txtLanguage.SendKeys(ExcelLibrary.ReadData(2, "Language")); //select level Base.driver.WaitForElement(By.Name("level")); SelectElement levelDropdown = new SelectElement(dropdownLevel); levelDropdown.SelectByValue(ExcelLibrary.ReadData(2, "Level")); //click on Add to save language btnAdd.Click(); }
public void UpdateLanguage() { PopulateDataForTabs(); // Base.driver.WaitForElement(By.XPath("//div[@class='twelve wide column scrollTable']/div/table/tbody/tr[1]/td[3]/span[1]/i")); // btnEditLanguage.Click(); //enter language in language textbox Base.driver.WaitForElement(By.XPath("//input[@name='name']")); txtLanguage.Clear(); txtLanguage.SendKeys(ExcelLibrary.ReadData(3, "Language")); //select level Base.driver.WaitForElement(By.Name("level")); SelectElement levelDropdown = new SelectElement(dropdownLevel); levelDropdown.SelectByValue(ExcelLibrary.ReadData(3, "Level")); //click on update to save language btnUpdateConfirmLanguage.Click(); }
// Login method performs login operation with valid credentials public void LogIn() { //populating data from excel sheet into datacollectiion ExcelLibrary.PopulateInCollectiion(ConstantHelpers.TestDataPath, "LogInSheet"); //String result = ExcelLibrary.ReadData(1, "Email"); Driver.WaitForElement(30, By.XPath("//*[@id='home']/div/div/div[1]/div/a")); //user clicks on SignIn button btnSignIn.Click(); //user enters valid username txtEmailAddress.SendKeys(ExcelLibrary.ReadData(2, "Email")); //user enters valid password txtPassword.SendKeys(ExcelLibrary.ReadData(2, "Password")); //user clicks on login button btnLogin.Click(); }
public void AddEducation() { PopulateDataForTabs(); //click on education tab // Base.driver.WaitForClickableElement(By.XPath("//a[@class='item'][contains(text(),'Education')]")); // tabEducation.Click(); //click on Addnew button Base.driver.WaitForClickableElement(By.XPath("//div[@id='account-profile-section']/descendant::section[2]/child::div/descendant::div[2]/child::div[3]/form/child::div[4]/descendant::div[6]/table/thead/tr/th[6]/div")); btnAddNewEducation.Click(); //college name textbox txtCollegeUni.SendKeys(ExcelLibrary.ReadData(2, "College Name")); //country dropdown Base.driver.WaitForElement(By.XPath("//select[@name='country']")); SelectElement CountryDropdown = new SelectElement(dropdownCollegeUni); CountryDropdown.SelectByValue(ExcelLibrary.ReadData(2, "Country of College")); //selecting title Base.driver.WaitForElement(By.XPath("//select[@name='title']")); SelectElement TitleDropdown = new SelectElement(dropdownTitle); TitleDropdown.SelectByValue(ExcelLibrary.ReadData(2, "Title")); //dgree textbox txtDegree.SendKeys(ExcelLibrary.ReadData(2, "Degree")); //selecting year of graduation Base.driver.WaitForElement(By.XPath("//select[@name='yearOfGraduation']")); SelectElement YearDropdown = new SelectElement(dropdownYear); YearDropdown.SelectByValue(ExcelLibrary.ReadData(2, "Year of graduation")); //click on add to save education btnAddEducation.Click(); }
//Selecting category at random in Searchskill result page public void SearchSkillBySelectingCategory() { PopulateDataForSearchSkill(); SearchSkillByCategory(); Base.driver.WaitForList(By.XPath("//div[@class='row']/descendant::div[@class='ui stackable three cards']")); int listCtegory = Category.Count(); if (listCtegory > 0) { for (int i = 0; i < listCtegory; i++) { String txtCategory = Category.ElementAt(i).Text; Console.WriteLine(txtCategory); if (txtCategory == ExcelLibrary.ReadData(2, "Category")) { Console.WriteLine(txtCategory); //Base.driver.WaitForList(By.XPath("//div[@class='ui link list']/a")); Category.ElementAt(i).Click(); } } } }