internal void EnterShareSkill() { Commondriver.Excellib.PopulateInCollection(Base.Excelpath, "Shareskills"); Title.SendKeys(Commondriver.Excellib.ReadData(2, "Title")); Description.SendKeys(Commondriver.Excellib.ReadData(2, "Description")); Commondriver.Wait(10); SelectElement catobj = new SelectElement(Category); catobj.SelectByText(Commondriver.Excellib.ReadData(2, "Category")); Commondriver.Wait(10); SelectElement Subcatobj = new SelectElement(Subcategory); Subcatobj.SelectByText(Commondriver.Excellib.ReadData(2, "Subcategory")); Tagname.SendKeys(Commondriver.Excellib.ReadData(2, "Tagname")); Tagname.SendKeys(Keys.Return); Servicetype.Click(); Locationtype.Click(); Startdate.SendKeys(Commondriver.Excellib.ReadData(2, "Start date")); Enddate.SendKeys(Commondriver.Excellib.ReadData(2, "End date")); Availabledays.Click(); Starttime.SendKeys(Commondriver.Excellib.ReadData(2, "Starttime")); Endtime.SendKeys(Commondriver.Excellib.ReadData(2, "End time")); Skilltrade.Click(); Credit.SendKeys(Commondriver.Excellib.ReadData(2, "Credit")); System.Threading.Thread.Sleep(3000); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); autoit.Send(@"D:\\Mars\\MarsPageF\\file.txt"); System.Threading.Thread.Sleep(3000); autoit.Send("{ENTER}"); Active.Click(); Save.Click(); }
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(); }
public void Addshareskilldetails() { //Click on the "Share Skill" Button Addshareskill.Click(); Thread.Sleep(1000); //Send data to the "Title" textbox Title.SendKeys("I am the Software test analyst with five years of experience using Selenium"); Thread.Sleep(1000); //Send data to the "Description" textbox Description.SendKeys("I love to do projects in the software testing and implementing the Page factory."); Thread.Sleep(1000); //Click the "Category" and Select the options in it IWebElement Category = Driver.driver.FindElement(By.XPath("//select[@name='categoryId']")); SelectElement Category_dd = new SelectElement(Category); Category_dd.SelectByValue("Business"); Thread.Sleep(1000); //Click the "Sub Category" for "business" and Select the options in it IWebElement SubCategory = Driver.driver.FindElement(By.XPath("//select[@name='subcategoryId']")); SelectElement SubCategory_dd = new SelectElement(SubCategory); SubCategory_dd.SelectByValue("Other"); Thread.Sleep(1000); //Tags Addtag.SendKeys(Keys.Enter); Thread.Sleep(1000); //Select the "service type" in which options between (1.Hourly basis service, 2- One-off service), Selectin "One-off service" Oneoffservice.Click(); Thread.Sleep(1000); //IWebElement Servicetype = Driver.driver.FindElement(By.XPath("//select[@name='categoryId']")); //SelectElement Servicetype_dd = new SelectElement(Servicetype); //Servicetype_dd.SelectByValue("1"); //Select the "location type" In which options between (1. Onsite, 2. Off Site), Selecting "Online" option //IWebElement Locationtype = Driver.driver.FindElement(By.XPath("//select[@name='categoryId']")); //SelectElement Locationtype_dd = new SelectElement(Locationtype); //Locationtype_dd.SelectByValue("1"); Onsite.Click(); Thread.Sleep(1000); //Enter data to the "Available Days" Startdate.SendKeys("07132019"); Thread.Sleep(1000); //Select the "Skilltrade" //IWebElement Skilltrade = Driver.driver.FindElement(By.XPath("//select[@name='categoryId']")); //SelectElement Skilltrade_dd = new SelectElement(Skilltrade); //Skilltrade_dd.SelectByValue("1"); //Select the "Skill-Exchange" option under the "Skill Trade" option Skilltrade.Click(); Thread.Sleep(1000); //Sending data in "Skill-Exchange" textbox and press "Enter" Skillexchange.SendKeys("Python"); Skillexchange.SendKeys(Keys.Enter); Thread.Sleep(1000); //Send data to the "Amount" textbox under the "Credit" field //Credit.SendKeys("2"); //Thread.Sleep(1000); //Select the "Active" field in which options (1.Active, 2. Hidden), Selecting "Active" option Active.Click(); Thread.Sleep(1000); //IWebElement Active = Driver.driver.FindElement(By.XPath("//h3[contains(text(),'Active')]")); //SelectElement Active_dd = new SelectElement(Active); //Active_dd.SelectByValue("true"); //Click on the "Save" Button Save.Click(); Thread.Sleep(1000); }