internal void EditListing(IWebDriver driver) { //Wait untill driver find Manage listing tab CommomDriver.WaitForVisibility(driver, "LinkText", "Manage Listings", 2); //After Viewing Skills click on ManageList to go back to Manage Listing ManageList.Click(); //Wait untill driver finf Edit button CommomDriver.WaitForVisibility(driver, "XPath", "(//i[@class='outline write icon'])[1]", 2); //Get Text from Category and Title from Manage list before Edit Aucketion String TitleBeforEdit = TitleofManage.Text; String CategoryBeforeEdit = CategoryofManage.Text; //Click on Edit icon Edit.Click(); //Random Wait CommomDriver.Wait(2); //create page object of share skill and call EnterShareSkill function //to perform Edit function in manage Listing Page ShareSkillPage ShareskillObj = new ShareSkillPage(); ShareskillObj.EnterShareSkill(driver); //Get text from Category and Title from Manage list after Edit String TitleAfterEdit = TitleofManage.Text; String CategoryAfterEdit = CategoryofManage.Text; Console.WriteLine(TitleBeforEdit); Console.WriteLine(TitleAfterEdit); Console.WriteLine(CategoryBeforeEdit); Console.WriteLine(CategoryAfterEdit); try { //Assert that text from Befor Edit and After Edit dose not have to match Assert.AreNotEqual(TitleBeforEdit, TitleAfterEdit); Assert.AreNotEqual(CategoryBeforeEdit, CategoryAfterEdit); Console.WriteLine("pass"); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Fail"); } }
internal void Register(IWebDriver driver) { // hit URL driver.Navigate().GoToUrl("http://192.168.99.100:5000/"); driver.Manage().Window.Maximize(); CommomDriver.Wait(2); //Click on Join Button Joinbtn.Click(); //populate login page data collection ExcelLibHelpers.PopulateInCollection(MarsResource.ExcelPath, "SignUp"); //Give FirstName FirstName.SendKeys(ExcelLibHelpers.ReadData(2, "First Name")); //Give LastName LastName.SendKeys(ExcelLibHelpers.ReadData(2, "Last Name")); //Give an Email Email.SendKeys(ExcelLibHelpers.ReadData(2, "Email")); //Give password Password.SendKeys(ExcelLibHelpers.ReadData(2, "Password")); //Give Conform Password ConformPsw.SendKeys(ExcelLibHelpers.ReadData(2, "Conform Password")); //Click on Check-Box CheckBox.Click(); //Click on Join button JoinBtn.Click(); try { //Wait untill CommomDriver.WaitForVisibility(driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/span", 20); //Assertion for checking condition Assert.That(LoginText.Text, Is.EqualTo(ExcelLibHelpers.ReadData(2, "Text"))); } catch (NoSuchElementException e) { Console.WriteLine(e.Message); } }
internal void EditShareSkill(IWebDriver driver) { CommomDriver.Wait(2000); //Click on ShareSkill Button ShareSkillBtn.Click(); //Wait untill driver find title text Field CommomDriver.WaitForVisibility(driver, "Name", "title", 2); //populate login page data collection ExcelLibHelpers.PopulateInCollection(MarsResource.ExcelPath, "EditShareSkill"); //Give a Title Title.SendKeys(ExcelLibHelpers.ReadData(2, "Title")); //Give a Description Description.SendKeys(ExcelLibHelpers.ReadData(2, "Description")); //select one of the option from Category Category.SendKeys(ExcelLibHelpers.ReadData(2, "Category")); ////Select SubCategory Option SubCategory.SendKeys(ExcelLibHelpers.ReadData(2, "Sub Category")); //give input in Tag TextField Tag.SendKeys(ExcelLibHelpers.ReadData(2, "Tag") + Keys.Enter); Tag.SendKeys(ExcelLibHelpers.ReadData(3, "Tag") + Keys.Enter); //choose Radio button option ServiceType.Click(); //Choose Location Location.Click(); //Give StartDate StartDate.SendKeys(ExcelLibHelpers.ReadData(2, "Start Date")); //Give EndDate EndDate.SendKeys(ExcelLibHelpers.ReadData(2, "End Date")); for (int i = 2; i < 9; i++) { for (int j = 2; j < 9; j++) { IWebElement SatrtTime = driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input")); IWebElement EndTime = driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input")); if (i == 2 && j == 2) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(2, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(2, "End Time")); } if (i == 3 && j == 3) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(3, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(3, "End Time")); } if (i == 4 && j == 4) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(4, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(4, "End Time")); } if (i == 5 && j == 5) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(5, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(5, "End Time")); } if (i == 6 && j == 6) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(6, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(6, "End Time")); } if (i == 7 && j == 7) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(7, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(7, "End Time")); } if (i == 8 && j == 8) { SatrtTime.SendKeys(ExcelLibHelpers.ReadData(8, "Start Time")); EndTime.SendKeys(ExcelLibHelpers.ReadData(8, "End Time")); } else { continue; } } } //Click on Share Trade Radio Button SkillTrade.Click(); //give inpute Skill Exchange SkillExchange.SendKeys(ExcelLibHelpers.ReadData(2, "Skill Exchange") + Keys.Enter + ExcelLibHelpers.ReadData(3, "Skill Exchange") + Keys.Enter); //Click on Work Sample WorkSample.Click(); //Handle the window that not belongs to Browser -AutoIt - see blog for more info //below line execute the AutoIT script //Create an object for AutoIt AutoItX3 autoIt = new AutoItX3(); //This statement Active the window and perform set of auctions autoIt.WinActivate("Open"); Thread.Sleep(1000); //set the path to open the file on browser autoIt.Send(@"D:\scrummeeting.png"); Thread.Sleep(1000); //It will click on "Open" button autoIt.Send("{ENTER}"); //click on active radio button Active.Click(); //click on save button savebtn.Click(); CommomDriver.Wait(2); //For Assertion- Go to manage list ManageList.Click(); //Get the text from manage list of Title and Category String ManageTitle = TitleofManage.Text; String ManageListCategory = CategoryofManage.Text; try { //For Assertion - After Save Skills For varification, //Goto manage list page and match Title and Cetegory with Excel Enter Skill Assert.AreEqual(ManageTitle, ExcelLibHelpers.ReadData(2, "Title")); Assert.AreEqual(ManageListCategory, ExcelLibHelpers.ReadData(2, "Category")); } catch (Exception e) { Console.WriteLine(e.Message); } }