public CoachSignInPage(IWebDriver driver) : base(driver) { WaitSelector.WaitingFor_ElementExists(this.Driver, By.Id("ContentPlaceHolder1_txtUsername")); txtUserName = new TextBox(driver, By.Id("ContentPlaceHolder1_txtUsername")); txtPassword = new TextBox(driver, By.Id("ContentPlaceHolder1_txtPassword")); btnSignIn = new Button(driver, By.XPath(".//input[@value='Sign In']")); txaLoadIcon = new TextArea(driver, By.Id("grid-loader-holder")); }
public T Select <T>() where T : CoachPageBase { /* * CoachMyProfilePage * CoachStaffPage * CoachSettingsPage * CoachAddNewsPage */ var xPath = string.Empty; var type = typeof(T); if (type.Equals(typeof(CoachMyProfilePage))) { xPath = string.Format(CST_SETTINGS_NAV, "My Profile"); } if (type.Equals(typeof(CoachStaffPage))) { xPath = string.Format(CST_SETTINGS_NAV, "Staff"); } if (type.Equals(typeof(CoachSettingsPage))) { xPath = string.Format(CST_SETTINGS_NAV, "Settings"); } if (type.Equals(typeof(CoachAddNewsPage))) { xPath = string.Format(CST_SETTINGS_NAV, "Add News"); } if (type.Equals(typeof(CoachSignInPage))) { xPath = string.Format(CST_SETTINGS_NAV, "Logout"); } if (string.IsNullOrEmpty(xPath)) { throw new Exception(string.Format("Unsupported page type for [{0}]", type.FullName)); } //click menu var settingsIcon = _driver.FindElement(By.XPath(CST_SETTINGS_ICON)); var action = new Actions(_driver); action.MoveToElement(settingsIcon).Perform(); var settingsMenu = WaitSelector.WaitingFor_GetElementWhenIsVisible(this._driver, By.XPath(xPath)); settingsMenu.Click(); var objPage = (T)Activator.CreateInstance(typeof(T), _driver); return(objPage); }
public CoachSignInPage Logout() { //click menu var settingsIcon = _driver.FindElement(By.XPath(CST_SETTINGS_ICON)); var action = new Actions(_driver); action.MoveToElement(settingsIcon).Perform(); var xPath = string.Format(CST_SETTINGS_NAV, "Logout"); var settingsMenu = WaitSelector.WaitingFor_GetElementWhenIsVisible(this._driver, By.XPath(xPath)); settingsMenu.Click(); return(new CoachSignInPage(this._driver)); }
public CoachDatabaseClubsDetailPage SetClubBaseInformation(ClubModel club) { txtClubName.SendKeys(club.Name); txtTeamName.SendKeys(club.TeamName); txtLocationName.SendKeys(club.Address.LocationName); txtAddressLine1.SendKeys(club.Address.AddressLine1); txtAddressLine2.SendKeys(club.Address.AddressLine2); txtAddressLine3.SendKeys(club.Address.AddressLine3); txtCity.SendKeys(club.Address.City); txtCounty.SendKeys(club.Address.County); ddlCountry.SelectByText(club.Address.Country); WaitSelector.HardWait(TimeSpan.FromSeconds(5)); ddlState.SelectByText(club.Address.State); txtZipCode.SendKeys(club.Address.ZipCode); txtClubWebsite.SendKeys(club.ClubWebsite); txtMainPhoneNumber.SendKeys(club.MainPhoneNumber); txtSeasonRecord.SendKeys(club.SeasonRecord); txtRecentGameResults.SendKeys(club.RecentGameResults); return(this); }
protected void ClosePopWindow(IWebDriver driver) { var waitTime = TimeSpan.FromSeconds(5); var waitHard = TimeSpan.FromSeconds(1); // New Updated Calendar Feature! if (WaitSelector.WaitingFor_ElementExists(driver, By.XPath("//span[contains(text(),'Thanks, but no thanks')]"), waitTime)) { var btnThanks = WaitSelector.WaitingFor_GetElementWhenIsVisible(driver, By.XPath("//span[contains(text(),'Thanks, but no thanks')]")); WaitSelector.HardWait(waitHard); btnThanks.Click(); WaitSelector.HardWait(waitHard); } if (WaitSelector.WaitingFor_ElementExists(driver, By.XPath("//span[contains(text(),'No thanks')]"), waitTime)) { var btnNoThanks = WaitSelector.WaitingFor_GetElementWhenIsVisible(driver, By.XPath("//span[contains(text(),'No thanks')]")); WaitSelector.HardWait(waitHard); btnNoThanks.Click(); WaitSelector.HardWait(waitHard); } if (WaitSelector.WaitingFor_ElementExists(driver, By.XPath("//span[contains(text(),'Close') and contains(@class,'close-link')]"), waitTime)) { var btnClose = WaitSelector.WaitingFor_GetElementWhenIsVisible(driver, By.XPath("//span[contains(text(),'Close') and contains(@class,'close-link')]")); WaitSelector.HardWait(waitHard); btnClose.Click(); WaitSelector.HardWait(waitHard); } // SUMMER IS HERE AGAIN!!! if (WaitSelector.WaitingFor_ElementExists(driver, By.XPath("//span[contains(text(),'Ok, got it')]"), waitTime)) { var btnGotIt = WaitSelector.WaitingFor_GetElementWhenIsVisible(driver, By.XPath("//span[contains(text(),'Ok, got it')]")); WaitSelector.HardWait(waitHard); btnGotIt.Click(); WaitSelector.HardWait(waitHard); } // }
/// <summary> /// NavigationTo other page /// </summary> /// <param name="mainMenu">mainMenu</param> /// <param name="subMenu">subMenu</param> public void Select(string mainMenu, string subMenu) { //ex: .//*[@id='contentnavtop']/ul[contains(@class,'navMenu')]/*/a[text()='Databases']/following-sibling::div[1]//a[text()='Prospects'] var mainMenuPath = string.Format(CST_MAIN_MENU_TEMP, mainMenu); //var eleMainMenu = _driver.FindElement(By.XPath(mainMenuPath)); var eleMainMenu = WaitSelector.WaitingFor_GetElementWhenIsVisible(this._driver, By.XPath(mainMenuPath)); var action = new Actions(_driver); action.MoveToElement(eleMainMenu).Perform(); var linkText = string.Format("{0}/following-sibling::div[1]//a[text()='{1}']", mainMenuPath, subMenu); var linkImg = string.Format("{0}/following-sibling::div[1]//span[text()='{1}']", mainMenuPath, subMenu); var eleSubMenu = WaitSelector.WaitingFor_GetElementWhenIsVisible(_driver, By.XPath(string.Format("{0} | {1}", linkText, linkImg))); //var eleSubMenu = _driver.FindElement(By.XPath(string.Format("{0} | {1}", linkText, linkImg))); //TODO: handler exception here. eleSubMenu.Click(); }
public void Waiting(For type, TimeSpan timeout) { switch (type) { case For.Exist: WaitSelector.WaitingFor_ElementExists(this._driver, this._by, timeout); break; case For.Visible: WaitSelector.WaitingFor_ElementIsVisible(this._driver, this._by, timeout); break; case For.Clickable: WaitSelector.WaitingFor_ElementToBeClickable(this._driver, this._by, timeout); break; case For.Invisibility: WaitSelector.WaitingFor_InvisibilityOfElementLocated(this._driver, this._by, timeout); break; default: throw new NotImplementedException(); } }
public CoachDatabaseClubsPage SetSearchTeam(string text) { txtSearchTeam.SendKeys(text); WaitSelector.HardWait(TimeSpan.FromSeconds(3)); return(this); }
public void WaitingTextToBePresent(string text) { WaitSelector.WaitingFor_TextToBePresentInElement(this._driver, this.OriginalElement, text, TimeSpan.FromSeconds(30)); }
public bool IsVisible() { return(WaitSelector.WaitingFor_GetElementWhenIsVisible(this._driver, this._by) != null); }
public bool IsExist() { return(WaitSelector.WaitingFor_GetElementWhenExists(this._driver, this._by) != null); }
public bool IsExist(string name) { return(WaitSelector.WaitingFor_ElementExists(_driver, By.XPath(string.Format(rootPath, name)))); }
public CoachDatabaseClubsDetailPage ClickSaveButton() { btnSaveTeam.Click(); WaitSelector.WaitingFor_UrlContains(this.Driver, "ClubDetail.aspx?initialaction=view"); return(this); }