/// <inheritdoc /> public override bool HandleDialog(Window window) { if (CanHandleDialog(window)) { _hwnd = window.Hwnd; if (_pressReTry) { ReTry.Click(); } else { Cancel.Click(); } return(true); } return(false); }
//Cancel public static void CancelSelectProductDetails() { log4net.Config.XmlConfigurator.Configure(); ILog logger = LogManager.GetLogger(typeof(SelectProductDetailsPage)); try { Cancel.Click(); Wait.WaitVisible(FrameYes, 10); FrameYes.Click(); } catch (Exception e) { logger.Error("Cancel Select Product Details failed due to : " + e); test.Fail("Cancel Select Product Details failed."); //**Closing browser Driver.Quit(); } }
internal void EnterShareSkill() { //Explicit wait GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[contains(.,'Share Skill')]")); //click shareskill ShareSkillButton.Click(); // Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); //Enter title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); // Select on Category Dropdown GlobalDefinitions.wait(10); SelectElement catg = new SelectElement(CategoryDropDown); catg.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select on SubCategory Dropdown GlobalDefinitions.wait(10); SelectElement subcatg = new SelectElement(SubCategoryDropDown); subcatg.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter Tag names in textbox Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Return); //Select the Service type if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis") { Hourly.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off") { Oneoff.Click(); } //Select the Location type if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "On-site") { Onsite.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "Online") { Online.Click(); } //Click on Start Date dropdown StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Click on End Date dropdown EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Select available days Days.Click(); //Select startTime StartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); //select endtime EndTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Skill-Exchange") { //select SkillTradeOption SkillTradeOption.Click(); //Enter SkillExchange SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Return); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Credit") { Credit.Click(); Creditvalue.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); Creditvalue.SendKeys(Keys.Enter); } //Click worksample Worksample.Click(); //Worksample.SendKeys("path"); //upload file using AutoIT AutoItX3 autoit = new AutoItX3(); //Activate so that next action happens on this window autoit.WinActivate("Open"); //autoit.Send(@"D:\Shareskillmars\FileUploadScript.exe"); autoit.Send(@"D:\Shareskillmars\sample.txt"); autoit.Send("{ENTER}"); Thread.Sleep(10000); //Select user option if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active") { StatusActive.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden") { StatusHidden.Click(); } //click save or cancel if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save") { Save.Click(); } else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel") { Cancel.Click(); } }
public static void CancelUpdate() { Cancel.Click(); }
public static void CancelUpdate() { Driver.CheckLocation(PageTypes.Profile); Cancel.Click(); }
//Add share skill details internal void EnterShareSkill() { //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); try { #region Navigate to Share Skills Page //Click on Share skill button GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "LinkText", "Share Skill", 10000); ShareSkillButton.Click(); #endregion #region Enter Title //Enter the Title in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "title", 10000); Title.Click(); Title.Clear(); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); #endregion #region Enter Description //Enter the Description in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "description", 10000); Description.Click(); Description.Clear(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); #endregion #region Category Drop Down //Select catagory from drop down GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "categoryId", 10000); CategoryDropDown.Click(); new SelectElement(CategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select catagory from drop down GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "subcategoryId", 10000); SubCategoryDropDown.Click(); new SelectElement(SubCategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); #endregion #region Tags //Enter Tag names in textbox GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='']", 10000); Tags.Click(); Tags.Clear(); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); #endregion #region Service Type Selection //Select service type if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis service") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", 10000); ServiceTypeOptions.Click(); ServicetypeHourly.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off service") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", 10000); ServiceTypeOptions.Click(); ServicetypeOneOff.Click(); } #endregion #region Select Location Type //Select the Location Type if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "On-site") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); LocationTypeOption.Click(); LocationSelOnsite.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "Online") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); LocationTypeOption.Click(); LocationSelOnline.Click(); } #endregion #region Select Available Dates from Calendar //Add start date StartDateDropDown.Click(); // StartDateDropDown.Clear(); StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Add End date EndDateDropDown.Click(); //EndDateDropDown.Clear(); EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Select available days GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//body/div/div/div[@id='service-listing-section']/div[@class='ui container']/div[@class='listing']/form[@class='ui form']/div[7]/div[2]/div[1]", 10000); Days.Click(); Mon.Click(); Tue.Click(); Wed.Click(); Thurs.Click(); //Select start time and enter the time GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[2]/input", 10000); StartTimeM.Click(); StartTimeDropDownM.Click(); StartTimeM.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[4]/div[2]/input", 10000); StartTimeT.Click(); StartTimeDropDownT.Click(); StartTimeT.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[5]/div[2]/input", 10000); StartTimeW.Click(); StartTimeDropDownW.Click(); StartTimeW.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[6]/div[2]/input", 10000); StartTimeTh.Click(); StartTimeDropDownTh.Click(); StartTimeTh.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt")); //Select end time from box GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[3]/input", 10000); EndTimeM.Click(); EndTimeDropDownM.Click(); EndTimeM.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[4]/div[3]/input", 10000); EndTimeT.Click(); EndTimeDropDownT.Click(); EndTimeT.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[5]/div[3]/input", 10000); EndTimeW.Click(); EndTimeDropDownW.Click(); EndTimeW.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[6]/div[3]/input", 10000); EndTimeTh.Click(); EndTimeDropDownTh.Click(); EndTimeTh.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt")); Thread.Sleep(1000); #endregion #region Select Skill Trade //Click on Skill trade option if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Skill-Exchange") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[8]/div[@class='twelve wide column']/div/div[@class='field']", 10000); SkillTradeOption.Click(); //Add Skill exchange tag GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input", 10000); SkillExchange.Click(); SkillExchange.Clear(); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Credit") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[8]/div[@class='twelve wide column']/div/div[@class='field']", 10000); SkillTradeOption.Click(); CreditBtn.Click(); //Addcredit amount GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/input", 10000); CreditAmount.Click(); CreditAmount.Clear(); CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "AmountInExchange")); CreditAmount.SendKeys(Keys.Enter); } #endregion #region Add Work Sample FileUpload.Click(); AutoItX3 autoIt = new AutoItX3(); AutoItX.WinWait("Open", "File Upload", 1); autoIt.WinActivate("Open"); Thread.Sleep(2000); var SampleWorkPath = MarsResource.SampleWorkPath; autoIt.Send(Path.GetFullPath(SampleWorkPath)); Thread.Sleep(2000); autoIt.Send("{Enter}"); Thread.Sleep(2000); #endregion #region Select User Status //Select option Active or Hidden if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); ActiveOption.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000); ActiveOption.Click(); HiddenOpt.Click(); } #endregion #region Save / Cancel Skill // Save or Cancel New Skill if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save") { GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='Save']", 10000); Save.Click(); } else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel") { Cancel.Click(); } #endregion } catch (Exception ex) { Assert.Fail("Test failed to enter Skill details", ex.Message); } }