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 MyBeazleyHomePage(IWebDriver driver, string title, string url, ContainerWebElement parentContainer = null) : base(driver, "myBeazley UAT - Quotes", url, parentContainer) { SignOutButton = new LinkWebElement <MyBeazleyLoginPage>("logoff", this); }
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 }