internal void AddImmigrationRecord(string document, string docNumber, string issueDate = null, string expiryDate = null, string eligibilityStatus = null, string issuedBy = null, string eligibilityReviewDate = null, string comments = null) { _logger.Info("Entering AddImmigrationRecord()."); AddBtn.Click(); // Decide which radio button to select if ((document == "Passport") || (document == "passport")) { _driver.FindElement(By.Id("immigration_type_flag_1")).Click(); } else { _driver.FindElement(By.Id("immigration_type_flag_2")).Click(); } //Enter remaining data DocNum.SendKeys(docNumber); IssDate.Clear(); IssDate.SendKeys(issueDate + Keys.Tab); ExDate.Clear(); ExDate.SendKeys(expiryDate + Keys.Tab); ElStatus.SendKeys(eligibilityStatus); IssBy.SendKeys(issuedBy); ElRevDate.Clear(); ElRevDate.SendKeys(eligibilityReviewDate + Keys.Tab); Comments.SendKeys(comments); //Click the Save button SaveBtn.Click(); _logger.Info("Exiting AddImmigrationRecord()."); }
//Edit Method public void EditListing(IWebDriver Driver) { //Populate the Excel sheet Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "EditShareSkillTestData"); //Click Manage Listings Menu ManageListingsMenu.Click(); Thread.Sleep(7000); //Click Edit Icon IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver; js1.ExecuteScript("arguments[0].click();", Element); Thread.Sleep(5000); //Change Title string title1 = Title.Text; Title.Clear(); Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Click Savebutton SaveBtn.Click(); Thread.Sleep(5000); //Verification ManageListingsMenu.Click(); Thread.Sleep(7000); //Click Edit icon IJavaScriptExecutor js2 = (IJavaScriptExecutor)Driver; js2.ExecuteScript("arguments[0].click();", Element); Thread.Sleep(5000); try { Assert.AreEqual("Industry Connect Software Tester", Title.Text); Console.WriteLine("Test1 passed : title edited successfully"); //Screenshot String img = Global.GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report"); Base.test.Log(LogStatus.Info, "Image example: " + img); //end test. (Reports) Base.extent.EndTest(Base.test); //calling Flush writes everything to the log file(Reports) Base.extent.Flush(); } catch (Exception e) { Console.WriteLine(e); Console.WriteLine("Test Fail: Skill listing NOT Edited"); } }
public void EditListing(IWebDriver Driver) { //Click Manage Listings Menu ManageListingsMenu.Click(); Thread.Sleep(7000); //Click Edit Icon IJavaScriptExecutor javascript = (IJavaScriptExecutor)Driver; javascript.ExecuteScript("arguments[0].click();", Element); Thread.Sleep(5000); //Change Title string title1 = Title.Text; Title.Clear(); Title.SendKeys(Helpers.ExcelLib.ReadData(2, "Title")); //Click Savebutton SaveBtn.Click(); Thread.Sleep(5000); ////Verification //var title2 = "Industry Connect Software Tester"; //if (title1 == title2) //{ // Console.WriteLine("Test1 passed : title edited successfully"); // //Screenshots // //Helpers.SaveScreenShotClass.SaveScreenshot(CommonDriver.Driver, "Edit Listing"); //} //else //{ // Console.WriteLine("Test1 failed : Title not edited"); //} try { IJavaScriptExecutor jse = (IJavaScriptExecutor)Driver; IWebElement element = Driver.FindElement(By.CssSelector("div:nth-child(2) table.ui.striped.table:nth-child(1) tbody:nth-child(2) tr:nth-child(1) > td.two.wide:nth-child(3)")); jse.ExecuteScript("return arguments[0].text", element); Assert.AreEqual("Industry Connect Software Tester", element); Console.WriteLine("Test Pass: Skill listing edited"); } catch (Exception) { Console.WriteLine("Test Fail: Skill listing NOT Edited"); } }
internal void AddDependent(string name, string relationship, string other = null, string dob = null) { _logger.Info("Entering AddDependent()"); AddBtn.Click(); DependentName.SendKeys(name); DependentRelationshipType.SendKeys(relationship); if ((relationship == "Other") || (relationship == "other")) { DependentRelationship.SendKeys(other); } DOB.Clear(); //DOB is not a required field DOB.SendKeys(dob + Keys.Tab); SaveBtn.Click(); _logger.Info("Exiting AddDependent()"); }
/// <summary> /// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load, /// depending on the button that was clicked /// </summary> /// <param name="buttonOrLinkElem">The element to click on</param> public dynamic ClickToAdvance(IWebElement buttonOrLinkElem) { if (Browser.Exists(Bys.UserManagementPage.SaveBtn)) { if (buttonOrLinkElem.GetAttribute("outerHTML") == SaveBtn.GetAttribute("outerHTML")) { SaveBtn.Click(); Browser.WaitForElement(Bys.GCEPUserMngPage.UsersManagementTbl, TimeSpan.FromSeconds(120), ElementCriteria.IsVisible, ElementCriteria.IsEnabled); //Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, TimeSpan.FromSeconds(60), ElementCriteria.IsEnabled); new WebDriverWait(Browser, TimeSpan.FromSeconds(90)).Until(ExpectedConditions.UrlContains("users")); return(new GCEPUserMngPage(Browser)); } else { throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button."); } } return(null); }
public void ClicknSave_Wthout_Changes() { //click Admin link from Dashboard AdminLink.Click(); //Click Customers link CustLink.Click(); Driver.wait(3); // Declaring variable to capture the ID of record before editing int Id_For_Rec_bfore_save = Int32.Parse(Driver.driver.FindElement(By.XPath("//*[@id=\"clientsGrid\"]/div[2]/table/tbody/tr[1]/td[1]")).Text); Console.WriteLine(Id_For_Rec_bfore_save); //Click Edit button on Customers Page Editbtn_Cust_page.Click(); //Pass control to IFrame (Edit Customer details) or Edit Client Driver.driver.SwitchTo().Frame(Driver.driver.FindElement(By.TagName("iframe"))); Driver.wait(2); SaveBtn.Click(); Driver.driver.SwitchTo().DefaultContent(); try { // Declaring variable to capture the ID of record after clicking save with no changes made. int Id_For_Rec_aftr_save = Int32.Parse(Driver.driver.FindElement(By.XPath("html/body/div[4]/div/div/div[2]/table/tbody/tr[1]/td[1]")).Text); Console.WriteLine(Id_For_Rec_aftr_save); Assert.AreEqual(Id_For_Rec_bfore_save, Id_For_Rec_aftr_save); Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "User is able to save Curtomer record without editing the record"); } catch (Exception e) { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "User is not able to save Curtomer record without editing the record"); } }
public string AddUser(UserRole role, string employeeName, string userName, Status status, string password) { SelectElement select = new SelectElement(Role); select.SelectByText(role.ToString()); EmployeeName.Clear(); EmployeeName.SendKeys(employeeName); UserName.Clear(); UserName.SendKeys(userName); select = new SelectElement(Status); select.SelectByText(status.ToString()); Password.Clear(); Password.SendKeys(userName); ConfirmPassword.Clear(); ConfirmPassword.SendKeys(userName); SaveBtn.Click(); try { return(string.Format("Error validating employee name: {0}", EmpNameValidationError.Text)); } catch (NoSuchElementException) { } try { return(string.Format("Error validating user name: {0}", UsrNameValidationError.Text)); } catch (NoSuchElementException) { } return("Success"); }
public void ShareProfile(string Decission) { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); Thread.Sleep(1000); //Enter Details to title filed Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter details to description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select the category IList <IWebElement> CategoryOptions = Category.FindElements(By.TagName("option")); for (int i = 0; i < CategoryOptions.Count; i++) { if (CategoryOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category")) { CategoryOptions[i].Click(); Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Category selected"); } } //------------------------------------------------------------------------------------- //Select Subcategory IList <IWebElement> SubcategoryOptions = SubCategory.FindElements(By.TagName("option")); for (int i = 0; i < SubcategoryOptions.Count; i++) { if (SubcategoryOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Subcategory")) { SubcategoryOptions[i].Click(); Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Subcategory Selected"); } } //------------------------------------------------------------------------------------------- //Enter a Tag Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tag1")); Tags.SendKeys(Keys.Enter); //Define Lists of radio button options in Skill Share page IList <IWebElement> ServiceTypeOptions = GlobalDefinitions.driver.FindElements(By.XPath("//div[@class='field']/div")); IList <IWebElement> Radiobtn = GlobalDefinitions.driver.FindElements(By.XPath("//div[@class='field']/div/input")); Thread.Sleep(1000); //--------------------------------------------------------------------------------------------- //Select Service Type for (int i = 0; i < ServiceTypeOptions.Count; i++) { if (ServiceTypeOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Service Type")) { Radiobtn[i].Click(); Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Service Type Selected"); } } //------------------------------------------------------------------------------------------ //Select Location Type for (int i = 0; i < ServiceTypeOptions.Count; i++) { if (ServiceTypeOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Location Type")) { Radiobtn[i].Click(); Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Location Type Selected"); } } //----------------------------------------------------------------------------------------------- //Enter start date StartDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Date")); Console.WriteLine(GlobalDefinitions.ExcelLib.ReadData(2, "Start Date")); //StartDate.SendKeys("06/16/2019"); Thread.Sleep(1000); //Enter end date //EndDate.Clear(); EndDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Date")); // --------------------------------------------------------------------------------- //Select Available Date and Time List <int> AvailableDays = new List <int> { 0, 1, 0, 1, 0, 0, 0 }; IList <IWebElement> Dayspath = Global.GlobalDefinitions.driver.FindElements(By.XPath("//input[@name='Available']")); IList <IWebElement> StartTime = Global.GlobalDefinitions.driver.FindElements(By.XPath("//input[@name='StartTime']")); IList <IWebElement> EndTime = Global.GlobalDefinitions.driver.FindElements(By.XPath("//input[@name='EndTime']")); if (AvailableDays[0] == 1) { Dayspath[0].Click(); StartTime[1].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime")); EndTime[0].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndTime")); } if (AvailableDays[1] == 1) { Dayspath[1].Click(); StartTime[1].SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "StartTime")); StartTime[1].SendKeys(Keys.ArrowDown); StartTime[1].SendKeys(Keys.ArrowDown); Console.WriteLine(GlobalDefinitions.ExcelLib.ReadData(3, "StartTime")); EndTime[1].SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "EndTime")); EndTime[1].SendKeys(Keys.ArrowDown); } if (AvailableDays[2] == 1) { Dayspath[2].Click(); StartTime[2].SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "StartTime")); EndTime[2].SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "EndTime")); } if (AvailableDays[3] == 1) { Dayspath[3].Click(); StartTime[3].SendKeys(GlobalDefinitions.ExcelLib.ReadData(5, "StartTime")); StartTime[3].SendKeys(Keys.ArrowDown); StartTime[3].SendKeys(Keys.ArrowDown); EndTime[3].SendKeys(GlobalDefinitions.ExcelLib.ReadData(5, "EndTime")); EndTime[3].SendKeys(Keys.ArrowDown); } if (AvailableDays[4] == 1) { Dayspath[4].Click(); StartTime[4].SendKeys(GlobalDefinitions.ExcelLib.ReadData(6, "StartTime")); EndTime[4].SendKeys(GlobalDefinitions.ExcelLib.ReadData(6, "EndTime")); } if (AvailableDays[5] == 1) { Dayspath[5].Click(); StartTime[5].SendKeys(GlobalDefinitions.ExcelLib.ReadData(7, "StartTime")); EndTime[5].SendKeys(GlobalDefinitions.ExcelLib.ReadData(7, "EndTime")); } if (AvailableDays[6] == 1) { Dayspath[6].Click(); StartTime[6].SendKeys(GlobalDefinitions.ExcelLib.ReadData(8, "StartTime")); EndTime[6].SendKeys(GlobalDefinitions.ExcelLib.ReadData(8, "EndTime")); } Thread.Sleep(1000); //-------------------------------------------------------------------------------- //Select Skill trade for (int i = 0; i < ServiceTypeOptions.Count; i++) { Console.WriteLine(ServiceTypeOptions[i].Text); if (ServiceTypeOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade")) { Radiobtn[i].Click(); Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skill Trade Selected"); } } //---------------------------------------------------------------------------------------- //Enter Skill Exchange tags SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill Exchange")); SkillExchange.SendKeys(Keys.Enter); //---------------------------------------------------------------------------------------- //Work Samples File Upload Thread.Sleep(2000); workSamplesUpload.Click(); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); //Activate the window autoit.Send(@"C:\Users\dell\Desktop\DESKTOP_AKILA\MVP studio\Mars Competition1\MarsFramework\MarsFramework\download.jpg"); Thread.Sleep(2000); autoit.Send("{ENTER}"); //-------------------------------------------------------------------------------------------- //Select Active for (int i = 0; i < ServiceTypeOptions.Count; i++) { Console.WriteLine(ServiceTypeOptions[i].Text); if (ServiceTypeOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Active")) { Radiobtn[i].Click(); Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Active Selected"); } } if (Decission == "Save") { SaveBtn.Click(); } else { CancelBtn.Click(); } }
public void SaveCompletedForm() { SaveBtn.Click(); }
internal void AddNewProduct() { ExcelLib.PopulateInCollection(InventoryTest.ExcelPath, "ProductPage"); Thread.Sleep(2000); //Select Invenotory menu Invetory.Click(); Thread.Sleep(2000); //Select Product menu Product.Click(); Thread.Sleep(2000); //Select Add New Product from menu AddProduct.Click(); Thread.Sleep(2000); //sending product code ProductCode.SendKeys(ExcelLib.ReadData(2, "ProductCode")); Thread.Sleep(1000); //sending product desc ProductDesc.SendKeys(ExcelLib.ReadData(2, "ProductDesc")); Thread.Sleep(1000); //sending barcode Barcode.SendKeys(ExcelLib.ReadData(2, "Barcode")); Thread.Sleep(1000); //sending Unitof measure //UnitOfMesureClick.Click(); //Thread.Sleep(2000); //UnitOfMesure.SendKeys(ExcelLib.ReadData(2, "UnitOfMesure")); var UnitOfMesure = CommonMethods.driver.FindElement(By.Id("Product_UnitOfMeasureId")); var selectUnitOfMesure = new SelectElement(UnitOfMesure); Thread.Sleep(1000); selectUnitOfMesure.SelectByText(ExcelLib.ReadData(2, "UnitOfMesure")); //sending Product group //ProductGrp.SendKeys(ExcelLib.ReadData(2, "ProductGroup")); var ProductGrpList = CommonMethods.driver.FindElement(By.Id("Product_ProductGroupId")); var selectProGrpVal = new SelectElement(ProductGrpList); Thread.Sleep(1000); selectProGrpVal.SelectByText(ExcelLib.ReadData(2, "ProductGroup")); Thread.Sleep(1000); //sending Pack size PackSize.SendKeys(ExcelLib.ReadData(2, "PackSize")); Thread.Sleep(1000); //Sending Weight ProductWeight.SendKeys(ExcelLib.ReadData(2, "ProductWeight")); Thread.Sleep(1000); //Sending Product width ProductWidth.SendKeys(ExcelLib.ReadData(2, "ProductWidth")); Thread.Sleep(1000); //sending Product Height ProductHeight.SendKeys(ExcelLib.ReadData(2, "ProductHeight")); Thread.Sleep(1000); //sending ProductDepth ProductDepth.SendKeys(ExcelLib.ReadData(2, "ProductDepth")); Thread.Sleep(1000); ////select Types //NeverDimishing.Click(); //Thread.Sleep(1000); ////CommonMethods.driver.SwitchTo().Alert().Dismiss(); //Obsolete.Click(); //Thread.Sleep(1000); ////CommonMethods.driver.SwitchTo().Alert().Dismiss(); //Sending Notes Notes.SendKeys(ExcelLib.ReadData(2, "Notes")); //savedata SaveBtn.Click(); Thread.Sleep(2000); ProductView.Click(); Thread.Sleep(1000); ProductCodeFilter.SendKeys(ExcelLib.ReadData(2, "ProductCode")); Thread.Sleep(1000); //press enter ProductCodeFilter.SendKeys(Keys.Enter); Thread.Sleep(4000); try { //verify record is added if (ExcelLib.ReadData(2, "ProductCode") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_2']/div/a")).Text) { if (ExcelLib.ReadData(2, "ProductDesc") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_3']/div/a")).Text) { if (ExcelLib.ReadData(2, "ProductGrp") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='ProductList_tccell0_3']/div/a")).Text) { SaveScreenShotClass.SaveScreenshot(CommonMethods.driver, "Found Added Product "); } } } else { SaveScreenShotClass.SaveScreenshot(CommonMethods.driver, "No record found "); } } catch (Exception e) { Console.WriteLine("Can not find added Product,Test failed" + e.Message); } }
public void EditSkills() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListings"); Thread.Sleep(4000); //Click on ManageListings button Thread.Sleep(5000); Global.GlobalDefinitions.driver.Navigate().Refresh(); ML.Click(); Thread.Sleep(4000); while (true) { var j = 1; while (j <= 10) { // identify 2nd row of table. Then extact the text and assign to a variable var Category1 = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[2]")).Text; var EditBtn = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[8]/i[2]")); //compare the text with the expected text. "Graphics & Design" if (Category1 == (Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category1"))) { //Click on Edit Button EditBtn.Click(); Thread.Sleep(3000); // Adding Title Title.Clear(); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Thread.Sleep(500); //Add Description Description.Clear(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Thread.Sleep(3000); //SaveBtn.Click(); Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); //Add Category Thread.Sleep(1500); //Actions action = new Actions(GlobalDefinitions.driver); //action.Click(Category); Category.Click(); //action.MoveToElement(Category).Build().Perform(); Console.WriteLine("Clicked on the Category"); Thread.Sleep(2000); IList <IWebElement> CategoryList = Category.FindElements(By.TagName("option")); int Count = CategoryList.Count; Thread.Sleep(500); for (int i = 0; i < Count; i++) { Console.WriteLine("in"); if (CategoryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category").Trim()) { Thread.Sleep(1000); CategoryList[i].Click(); Base.test.Log(LogStatus.Info, " Category Selected"); } } //Add SubCategory SubCategory.Click(); Console.WriteLine("Clicked on the SubCategory"); Thread.Sleep(2000); IList <IWebElement> SubCategoryList = SubCategory.FindElements(By.TagName("option")); //int count = SubCatogeryList.Count; Thread.Sleep(500); for (int i = 0; i < SubCategoryList.Count; i++) { if (SubCategoryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")) //if (SubCatogeryList[i].Text == " Other".Trim()) { Thread.Sleep(1000); SubCategoryList[i].Click(); Base.test.Log(LogStatus.Info, " SubCategory Selected"); } } // Add Tags Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); // Select Service Type Thread.Sleep(1000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "One-off service") { ServiceType.Click(); } else { Servicetype.Click(); } Base.test.Log(LogStatus.Info, "Service type Edited successfully"); //Select Location Type Thread.Sleep(1000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "Online") { LocationType.Click(); } else { Locationtype.Click(); } Base.test.Log(LogStatus.Info, "Location Type Edited successfully"); //Monday Check Box Selection Thread.Sleep(2000); Boolean X = MondayCheckBox.Selected; if (X == false) { MondayCheckBox.Click(); } MondayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time")); Thread.Sleep(1000); MondayEndTime.Clear(); MondayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time")); Thread.Sleep(1000); //Tuesday Selection //TuesdayCheckBox.Click(); //TuesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Start Time")); //TuesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "End Time")); //Days selection Thursdaycheckbox.Click(); Thread.Sleep(2000); ThursdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time")); ThursdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time")); //Selecting Skill Trade if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Skill-exchange") { SkillTrade.Click(); } else { Skilltrade.Click(); } Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); // Enter Skill Exchange AutoItX3 autoItx = new AutoItX3(); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); autoItx.Send("{Enter}"); Thread.Sleep(3000); Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); //Upload WorkSample Thread.Sleep(4000); WorkSample.Click(); Thread.Sleep(1000); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); autoit.Send(@"c:\users\rajesh jasti\Documents\Worksamples.xlsx"); Thread.Sleep(5000); autoit.Send("{Enter}"); Base.test.Log(LogStatus.Info, "Work Sample Updated successfully"); // select Active Thread.Sleep(1000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Active") == "Active") { ActiveBtn.Click(); } else { Hidden.Click(); } //Click on Save Button SaveBtn.Click(); Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); return; } j++; } var btnNext = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div/button[4]")); btnNext.Click(); } var Title1 = (Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[3]/td[2]")).Text); Assert.AreEqual("Test Analyst", Title1); Console.WriteLine(" Skills Edited Successfully"); }
////Click on View Button //[FindsBy(How = How.XPath, Using = "//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[1]/td[8]/i[1]")] //private IWebElement ViewBtn { get; set; } #endregion #region Add Skills public void AddShareSkills() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkills"); Thread.Sleep(2000); //Click on ShareSkills Thread.Sleep(5000); Shareskills.Click(); //Click on Title Thread.Sleep(5000); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Thread.Sleep(500); //Click on Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Base.test.Log(LogStatus.Info, "Description Added Sucessfully"); //Add Category Thread.Sleep(4000); //Actions action = new Actions(GlobalDefinitions.driver); //action.Click(Category); Category.Click(); //action.MoveToElement(Category).Build().Perform(); Console.WriteLine("Clicked on the Category"); Thread.Sleep(2000); IList <IWebElement> CategoryList = Category.FindElements(By.TagName("option")); int Count = CategoryList.Count; Thread.Sleep(500); for (int i = 0; i < Count; i++) { Console.WriteLine("in"); if (CategoryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category").Trim()) //if (CategoryList[i].Text == " Graphics & Design ".Trim()) { Thread.Sleep(1000); CategoryList[i].Click(); Base.test.Log(LogStatus.Info, " Category Selected"); } } //Add SubCategory SubCategory.Click(); Console.WriteLine("Clicked on the SubCategory"); Thread.Sleep(2000); IList <IWebElement> SubCatogeryList = SubCategory.FindElements(By.TagName("option")); //int count = SubCatogeryList.Count; Thread.Sleep(500); for (int i = 0; i < SubCatogeryList.Count; i++) { if (SubCatogeryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory").Trim()) { Thread.Sleep(1000); SubCatogeryList[i].Click(); Base.test.Log(LogStatus.Info, " SubCategory Selected"); } } // Add Tags AutoItX3 autoIt = new AutoItX3(); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); autoIt.Send("{Enter}"); Base.test.Log(LogStatus.Info, " Tags Added successfully"); // Select Service Type Thread.Sleep(1000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == " Hourly badis sevice ") { Servicetype.Click(); } else { ServiceType.Click(); } Base.test.Log(LogStatus.Info, "Service type Added successfully"); //Select Location Type Thread.Sleep(1000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "On-site") { Locationtype.Click(); } else { LocationType.Click(); } Base.test.Log(LogStatus.Info, "Location Type Edited successfully"); //Monday selection MondayCheckBox.Click(); MondayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time")); Thread.Sleep(1000); MondayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time")); Thread.Sleep(1000); //Tuesday Selection TuesdayCheckBox.Click(); TuesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Start Time")); TuesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "End Time")); //Wednesday Selection Wednesdaycheckbox.Click(); WednesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "Start Time")); WednesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "End Time")); //Selecting Skill Trade if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Credit") { Thread.Sleep(1000); Skilltrade.Click(); } else { Thread.Sleep(1000); SkillTrade.Click(); } Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); // Enter Credit Thread.Sleep(1000); Credit.Clear(); Credit.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); Thread.Sleep(1000); Base.test.Log(LogStatus.Info, " Service Listing updated successfully"); //Upload WorkSample Thread.Sleep(3000); WorkSample.Click(); Thread.Sleep(1000); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); autoit.Send(@"c:\users\rajesh jasti\Documents\ProfilePhoto.jpg"); Thread.Sleep(2000); autoit.Send("{Enter}"); Base.test.Log(LogStatus.Info, "Image Edited successfully"); //Selecting Active Thread.Sleep(4000); if (GlobalDefinitions.ExcelLib.ReadData(2, "Active") == "Hidden") { Hidden.Click(); } else { ActiveBtn.Click(); } //Click on Save Button SaveBtn.Click(); }
internal void CreateCustomerValid() { ExcelLib.PopulateInCollection(Test.Base.ExcelPath, "Customer"); // Go to Admin > Customer Driver.wait(2); AdminLink.Click(); CustLink.Click(); Driver.wait(2); // Create Customer CreateNewBtn.Click(); Driver.wait(2); CustNameTB.Clear(); CustNameTB.SendKeys(ExcelLib.ReadData(2, "Name")); // Edit Contact EditContactBtn.Click(); WebDriverWait wait = new WebDriverWait(Driver.driver, TimeSpan.Parse("10")); IWebElement element = wait.Until( ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Id("FirstName")) ).FirstOrDefault(); element.SendKeys("test"); //FirstNameTB.Click(); //FirstNameTB.SendKeys("Myfirst"); //// FirstNameTB.SendKeys(ExcelLib.ReadData(2, "FirstName")); // LastNameTB.Clear(); // LastNameTB.SendKeys(ExcelLib.ReadData(2, "LastName")); // PreferredNameTB.Clear(); // PreferredNameTB.SendKeys(ExcelLib.ReadData(2, "PreferredName")); // PhoneTB.Clear(); // PhoneTB.SendKeys(ExcelLib.ReadData(2, "Phone")); // MobileTB.Clear(); // MobileTB.SendKeys(ExcelLib.ReadData(2, "Mobile")); // EmailTB.Clear(); // EmailTB.SendKeys(ExcelLib.ReadData(2, "Email")); // FaxTB.Clear(); // FaxTB.SendKeys(ExcelLib.ReadData(2, "Fax")); // StreetTB.Clear(); // StreetTB.SendKeys(ExcelLib.ReadData(2, "Street")); // CityTB.Clear(); // CityTB.SendKeys(ExcelLib.ReadData(2, "City")); // CountryTB.Clear(); // CountryTB.SendKeys(ExcelLib.ReadData(2, "Country")); SaveContactBtn.Click(); //ExitEditContactBtn.Click(); Driver.wait(10); // Billing Contact IsSameContactBtn.Click(); //GST GstTB.Clear(); GstTB.SendKeys(ExcelLib.ReadData(2, "GST")); // Save Customer SaveBtn.Click(); Driver.wait(10); }
internal PagesPage SavePage() { SaveBtn.Click(); this.VerifySavePage(); return(this); }