public static void WaitUntilElementNameIsDisplayed(this AutomatedElement ele, IWebDriver _driver, double waitingSec, string str) { WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(waitingSec)); try { wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); wait.Until <Boolean>((d) => { ReadOnlyCollection <IWebElement> elements = d.FindElements(ele.ByElement); foreach (var elemen in elements) { if (elemen.Text.ToLower().Contains(str.ToLower())) { return(true); } } return(false); }); } catch (Exception e) { throw new Exception("Element Name: " + ele.Name + " - Element Locator: " + ele.ByElement.ToString() + " Not Exists"); } }
public static void WaitUntilWebElementEnabledAndDispalyed(this AutomatedElement ele, IWebDriver _driver, double waitingSec) { WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(waitingSec)); try { wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); wait.Until <IWebElement>((d) => { IWebElement element = d.FindElement(ele.ByElement); if (element.Displayed && element.Enabled) { return(element); } return(null); }); } catch (Exception e) { AutomatedLogger.Log("Element Name: " + ele.Name + " - Element Locator: " + ele.ByElement.ToString() + " Not Exists" + "and Exception is " + e.Message); throw; } }
public static bool WaitUntilWebElementTextChanged(this AutomatedElement ele, IWebDriver _driver, double waitingSec) { bool tasksLoaded = false; WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(waitingSec)); try { wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); wait.Until <Boolean>((d) => { IWebElement element = d.FindElement(ele.ByElement); if (element.Text != "No Data") { tasksLoaded = true; } return(tasksLoaded); }); } catch (Exception e) { throw new Exception("Element Name: " + ele.Name + " - Element Locator: " + ele.ByElement.ToString() + " Not Exists" + "and Exception is " + e.Message); } return(tasksLoaded); }
public static void WaitUntilWebElementWithNameLoaded(this AutomatedElement ele, string name, IWebDriver _driver, double waitingSec) { WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(waitingSec)); try { wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); wait.Until <Boolean>((d) => { ReadOnlyCollection <IWebElement> elements = d.FindElements(ele.ByElement); foreach (var e in elements) { if (e.Text.Equals(name) && e.Displayed && e.Enabled) { return(true); } } return(false); }); } catch (Exception e) { throw new Exception("Element Name: " + ele.Name + " - Element Locator: " + ele.ByElement.ToString() + " Not Exists" + "and Exception is " + e.Message); } }
public static bool WaitUntilWebElementsLoaded(this AutomatedElement ele, int elementCount, IWebDriver _driver, double waitingSec) { bool elementIsLoaded = false; WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(waitingSec)); try { wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); wait.Until <Boolean>((d) => { ReadOnlyCollection <IWebElement> elements = d.FindElements(ele.ByElement); if (elements.Count >= elementCount) { elementIsLoaded = true; } return(elementIsLoaded); }); } catch (Exception e) { throw new Exception("Element Name: " + ele.Name + " - Element Locator: " + ele.ByElement.ToString() + " Not Exists" + "and Exception is " + e.Message); } return(elementIsLoaded); }
public HomePage(IWebDriver driver) { this.driver = driver; AutomatedActions.NavigationActions.InitBrowser(driver); PageElements = ElementParser.Initialize_Page_Elements(ApplicationConfigs.ObjectRepository + "Home\\HomePage.json"); _searchBox = PageElements["searchBox"]; _searchbBtn = PageElements["searchbBtn"]; }
public GameDetailsPage(IWebDriver driver) { _driver = driver; pageElements = ElementParser.Initialize_Page_Elements(ApplicationConfigs.ObjectRepository + @"GameDetails\GameDetails.json"); _addToCartBtn = pageElements["addToCartBtn"]; _gameName = pageElements["gameName"]; _screeShots = pageElements["screeShots"]; _quantityDdl = pageElements["quantityDdl"]; }
public ResturantSelectionPage(IWebDriver driver) { this.driver = driver; AutomatedActions.NavigationActions.InitBrowser(driver); PageElements = ElementParser.Initialize_Page_Elements(ApplicationConfigs.ObjectRepository + "Orders\\ResturantSelectionPage.json"); _resturantSearchBox = PageElements["resturantSearchBox"]; _resturantList = PageElements["resturantList"]; }
public static void UploadFile(string filePath, AutomatedElement element) { AutomatedActions.ClickActions.ClickOnElement(element); Thread.Sleep(5000); SendKeys.SendWait(filePath); Thread.Sleep(5000); SendKeys.SendWait(@"{Enter}"); Thread.Sleep(5000); }
public OrderVerificationPage(IWebDriver driver) { this.driver = driver; AutomatedActions.NavigationActions.InitBrowser(driver); PageElements = ElementParser.Initialize_Page_Elements(ApplicationConfigs.ObjectRepository + "Orders\\OrderVerificationPage.json"); _orderId = PageElements["orderId"]; _resturantName = PageElements["resturantName"]; }
public void SelectFrom_CountriesList(string Country) { FindVisibleElement(20, lst_Countries, "Countries List", ElementValidation.Mandatory); ClickElement(lst_Countries, "Countries List", ElementValidation.Mandatory); AutomatedElement span_country = new AutomatedElement(LocateBy.XPath, LocatorValue: "//span[text() = '" + Country + "']"); ClickElement(span_country, "Country " + Country, ElementValidation.Mandatory); }
public LoginPage(IWebDriver driver) { this.driver = driver; AutomatedActions.NavigationActions.InitBrowser(driver); PageElements = ElementParser.Initialize_Page_Elements(ApplicationConfigs.ObjectRepository + "Login\\LoginPage.json"); _emailTextfield = PageElements["emailTextfield"]; _nextBtn = PageElements["nextBtn"]; _passwordTextField = PageElements["passwordTextField"]; _nextBtn2 = PageElements["nextBtn2"]; }
public PaymentConfirmationPage(IWebDriver driver) { this.driver = driver; AutomatedActions.NavigationActions.InitBrowser(driver); PageElements = ElementParser.Initialize_Page_Elements(ApplicationConfigs.ObjectRepository + "Payment\\PaymentConfirmationPage.json"); _cancelBtn = PageElements["cancelBtn"]; _yesBtn = PageElements["yesBtn"]; _saveCookiesBtn = PageElements["saveCookiesBtn"]; _tryAgainBtn = PageElements["tryAgainBtn"]; }
public PaymentDetailsPage(IWebDriver driver) { this.driver = driver; AutomatedActions.NavigationActions.InitBrowser(driver); PageElements = ElementParser.Initialize_Page_Elements(ApplicationConfigs.ObjectRepository + "Payment\\PaymentDetailsPage.json"); _idealMethodBtn = PageElements["idealMethodBtn"]; _cashMethodBtn = PageElements["cashMethodBtn"]; _addressText = PageElements["addressText"]; _townText = PageElements["townText"]; _surNameText = PageElements["surNameText"]; _emailAddressText = PageElements["emailAddressText"]; _phoneNumberText = PageElements["phoneNumberText"]; _buyNowBtn = PageElements["buyNowBtn"]; }
public HomePage(IWebDriver driver) { pageElements = ElementParser.Initialize_Page_Elements(ApplicationConfigs.ObjectRepository + @"Home\Home.json"); _gameBtn = pageElements["gameBtn"]; _rightSliderController = pageElements["rightSliderController"]; _leftSliderController = pageElements["leftSliderController"]; _slider = pageElements["slider"]; _gameItemsList = pageElements["gameItemsList"]; _shoppingMenuItem = pageElements["shoppingMenuItem"]; _shoppingBagItemText = pageElements["shoppingBagItemText"]; lastitemInGameList = 0; _addToCartItem = pageElements["addToCartItem"]; gameName = string.Empty; driver = this.driver; }
public OrderCreationPage(IWebDriver driver) { this.driver = driver; AutomatedActions.NavigationActions.InitBrowser(driver); PageElements = ElementParser.Initialize_Page_Elements(ApplicationConfigs.ObjectRepository + "Orders\\OrderCreationPage.json"); _mealsList = PageElements["mealsList"]; _mealNameList = PageElements["mealNameList"]; _addOneBtn = PageElements["addOneBtn"]; _drinkDdl = PageElements["drinkDdl"]; _addMainDishBtn = PageElements["addMainDishBtn"]; _basketBtn = PageElements["basketBtn"]; _commentBtn = PageElements["commentBtn"]; _commentText = PageElements["commentText"]; _OrderBtn = PageElements["OrderBtn"]; }
public HomePage(IWebDriver driver) { this.driver = driver; AutomatedActions.NavigationActions.InitBrowser(driver); PageElements = ElementParser.Initialize_Page_Elements(ApplicationConfigs.ObjectRepository + "Home\\HomePage.json"); _composeBtn = PageElements["composeBtn"]; _toTextField = PageElements["toTextField"]; _subjectTextField = PageElements["subjectTextField"]; _body = PageElements["body"]; _threeDotsBtn = PageElements["threeDotsBtn"]; _labelOptions = PageElements["labelOptions"]; _socialCheckBox = PageElements["socialCheckBox"]; _sendBtn = PageElements["sendBtn"]; _inbox = PageElements["inbox"]; _firstMailStarred = PageElements["firstMailStarred"]; _myReceivedMail = PageElements["myReceivedMail"]; _receivedMailSubject = PageElements["receivedMailSubject"]; }
public static void WaitTillElementDisappers(AutomatedElement ele, IWebDriver _driver, double waitingSec) { WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(waitingSec)); try { wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); wait.Until <Boolean>((d) => { if (!(AutomatedActions.ElementActions.IsDisplayed(ele))) { return(true); } else { return(false); } }); } catch (Exception e) { throw new Exception("Element Name: " + ele.ToString() + " still appears " + "and Exception is " + e.Message); } }
public void SelectFrom_AddressList(int OptionNumber) { AutomatedElement span_Option = new AutomatedElement(LocateBy.Id, LocatorValue: "autocomplete-list-option" + OptionNumber); ClickElement(span_Option, " Option of address list number " + OptionNumber, ElementValidation.Mandatory); }
public void Ensure_Session_IsDisplayed_CourseMap(string SessionTitle, ElementValidation validation) { AutomatedElement lbl_SessionInMap = new AutomatedElement(LocateBy.XPath, LocatorValue: "//*[@title='" + SessionTitle + "']"); ExplicitlyConfirm_ElementFound(20, lbl_SessionInMap, "Session with Title " + SessionTitle, validation); }