public ContainerContext(ContainerBasePage container, ContainerContext parentContext = null) { _containingElement = container.Container; // the iframe _containerPage = container; _containerType = container.Type; _containerSwitchers = new Dictionary<ContainerType, Action<IWebDriver>>() { { ContainerType.Frame, driver => { driver.SwitchTo().Frame(_containingElement.Element); Log.Info(string.Format("Switched to Frame {0}", _containingElement.Identifier)); }}, { ContainerType.Alert, driver => driver.SwitchTo().Alert()}, { ContainerType.Window, driver => driver.SwitchTo().Window(_containerPage.NewestWindowHandle)}, { ContainerType.Element, driver => driver.SwitchTo().ActiveElement() } }; _containerRestorers = new Dictionary<ContainerType, Action<IWebDriver>>() { { ContainerType.Frame, driver => { if (HasParentContext(parentContext)) SwitchToParentContext(parentContext); else SwitchToDefaultContent(driver); } }, { ContainerType.Alert, driver => { driver.SwitchTo().DefaultContent(); Log.Info("Switched to DefaultContent"); }}, //? { ContainerType.Window, driver => driver.SwitchTo().Window(_containerPage.LastKnownWindowHandle)}, { ContainerType.Element, driver => driver.SwitchTo().ActiveElement() } //? }; Switch(); }
public ContainerBasePage(IWebDriver driver, ContainerType? containerType, string title = null, string url = null, ContainerWebElement parentContainer = null) : base(driver, title, url, parentContainer) { if (containerType != null) Type = containerType.Value; ActionsBeforeInit(); InitContainerContext(); }
public WebElement(string identifier, BasePage parentPage, Type nextPage = null, ContainerType?containerType = null, ContainerWebElement parentContainer = null) { Identifier = identifier; ParentPage = parentPage; NextPage = nextPage; ParentContainer = parentContainer; NextPageContainerType = containerType; }
public WebElement(string identifier, BasePage parentPage, Type nextPage = null, ContainerType? containerType = null, ContainerWebElement parentContainer = null) { Identifier = identifier; ParentPage = parentPage; NextPage = nextPage; ParentContainer = parentContainer; NextPageContainerType = containerType; }
public DropdownWebElement(string identifier, BasePage parentPage, ContainerType? containerType = null, ContainerWebElement container = null) : base(identifier, parentPage, null, containerType, container) { Selector = new Dictionary<SelectionKind, Action<object>> { {SelectionKind.Text, x => Select.SelectByText((string) x)}, {SelectionKind.Value, x => Select.SelectByValue((string) x)}, {SelectionKind.Index, x => Select.SelectByIndex((int) x)} }; }
public T ClickAndTreatAlertAndOpenPopup(ContainerWebElement popupContainer, AlertResolveType alertResolveStatus = AlertResolveType.Accept, int timeToWaitForAlert = 60000) { ParentPage.LastKnownWindowHandle = ParentPage.Driver.CurrentWindowHandle; ParentPage.WindowHandlesSnapshot = ParentPage.Driver.WindowHandles; ClickAndTreatAlert(alertResolveStatus, timeToWaitForAlert, true); var page = GetPageInstance(popupContainer) as T; return(page); }
public MyBeazleyLoginPage(IWebDriver driver, string title = null, string url = null, ContainerWebElement parentContainer = null) : base(driver, "myBeazley UAT", url, parentContainer) { //Beazley Link LinkLogoBeazley = new LinkWebElement<MyBeazleyLoginPage>("LinkLogoBeazley", this); //Privacy links - RB_PrivacyLinks PrivacyLinks = new LinkWebElement<MyBeazleyLoginPage>("PrivacyLinks", this); //Privacy links - RB_PrivacyLinks TcPrivacyLinks = new LinkWebElement<MyBeazleyLoginPage>("TC_PrivacyLinks", this); //Privacy links - RB_PrivacyLinks PcPrivacyLinks = new LinkWebElement<MyBeazleyLoginPage>("PC_PrivacyLinks", this); //Header logo HeaderLogo = new WebElement("HeaderLogo", this); //myBeazley right image BeazleyRightImage = new LinkWebElement<MyBeazleyLoginPage>("BeazleyRightImage", this); //Sign in title label TitleLabelLogin = new WebElement("TitleLabelLogin", this); //Sign in Submit BtnSignIn = new LinkWebElement<MyBeazleyHomePage>("BtnSignIn", this); //Sign in Submit FailedBtnSignIn = new WebElement("BtnSignIn", this); //Username field and label //UsernameField = new WebElement(Locator.Create(With.Id, "UsernameField"), this); UsernameField = new WebElement("UsernameField", this); UsernameLabel = new WebElement("UsernameLabel", this); //Password Field and label PasswordField = new WebElement("PasswordField", this); PasswordLabel = new WebElement("PasswordLabel", this); //Forgotten your password? ForgottenPassword = new LinkWebElement<MyBeazleyLoginPage>("ForgottenPassword", this); //DdlSelectLanguage = new SelectWebElement(Locator.Create(With.Id, "searchlang"), this); LanguageLocator = new WebElement("LanguageLocator", this); ErrorLoginMessage = new WebElement("ErrorLoginMessage", this); EmptyUsernameError = new WebElement("EmptyUsernameError", this); //loginerror }
public BasePage(IWebDriver driver, string title, string url, ContainerWebElement parentContainer = null) { GetPageFromConfig(); Driver = driver; Title = title; var containerBasePage = this as ContainerBasePage; if (containerBasePage != null) containerBasePage.Container = parentContainer; DefaultTimeout = TimeSpan.FromSeconds(30); DefaultPollingFrequency = TimeSpan.FromMilliseconds(250); Url = url; Load(); StoreWindowHandle(); }
public BasePage(IWebDriver driver, string title, string url, ContainerWebElement parentContainer = null) { GetPageFromConfig(); Driver = driver; Title = title; var containerBasePage = this as ContainerBasePage; if (containerBasePage != null) { containerBasePage.Container = parentContainer; } DefaultTimeout = TimeSpan.FromSeconds(30); DefaultPollingFrequency = TimeSpan.FromMilliseconds(250); Url = url; Load(); StoreWindowHandle(); }
public MyBeazleyHomePage(IWebDriver driver, string title, string url, ContainerWebElement parentContainer = null) : base(driver, "myBeazley UAT - Quotes", url, parentContainer) //ova e title { SignOutButton = new LinkWebElement<MyBeazleyLoginPage>("logoff", this); }
public ContainerBasePage(IWebDriver driver, ContainerType?containerType, string title = null, string url = null, ContainerWebElement parentContainer = null) : base(driver, title, url, parentContainer) { if (containerType != null) { Type = containerType.Value; } ActionsBeforeInit(); InitContainerContext(); }
public object GetPageInstance(ContainerWebElement popup) { var page = Activator.CreateInstance(NextPage, ParentPage.Driver, NextPageContainerType, null, popup) as BasePage; return page; }
public object GetPageInstance(ContainerWebElement popup) { var page = Activator.CreateInstance(NextPage, ParentPage.Driver, NextPageContainerType, null, popup) as BasePage; return(page); }
public ContainerWebElement(string identifier, BasePage parentPage, ContainerType containerType = ContainerType.Element, ContainerWebElement container = null) : base(identifier, parentPage, null, containerType, container) { Type = containerType; WindowName = null; }
public DropdownWebElement(string identifier, BasePage parentPage, ContainerType?containerType = null, ContainerWebElement container = null) : base(identifier, parentPage, null, containerType, container) { Selector = new Dictionary <SelectionKind, Action <object> > { { SelectionKind.Text, x => Select.SelectByText((string)x) }, { SelectionKind.Value, x => Select.SelectByValue((string)x) }, { SelectionKind.Index, x => Select.SelectByIndex((int)x) } }; }
public LinkWebElement(string identifier, BasePage parentPage, ContainerType?containerType = null, ContainerWebElement containerWebElement = null) : base(identifier, parentPage, typeof(T), containerType, containerWebElement) { ParentContainer = containerWebElement; }