public MenuControl(Browser browser, IElement parent, IElementLocator locator) : base(browser, parent, locator) { this.TxtUserName = WebElement.Create(this.browser, this, ElementLocator.Create(By.Id, "userName")); this.TxtPassword = WebElement.Create(this.browser, this, ElementLocator.Create(By.Id, "password")); this.BtnLogin = WebElement.CreateNavigation <Test000HomePage>(this.browser, this, ElementLocator.Create(By.Id, "login")); }
public Test000HomePage() : base("Virtual Store - Home") { this.LblUserName = WebElement.Create(this, ElementLocator.Create(By.Id, "username")); this.BtnLogin = WebElement.CreateNavigation <Test000HomePage>(this, ElementLocator.Create(By.Id, "login")); this.CtlMenu = WebElement.CreateControl <MenuListItemControl>(this, ElementLocator.Create(By.Id, "menu")); }
public void ShouldNotCrashIfElementNotAvailable() { var elStatusPage = Browser.Open <ElementStatusPage>(); var unrealElement = WebElement.Create(null, ElementLocator.Create(By.Id, "doesNotExist")); Assert.IsFalse(unrealElement.IsAvailable); }
public Test001CalculatorPage(Browser browser) : base(browser, "Calculator") { this.TxtOperand1 = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "operand1")); this.TxtOperand2 = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "operand2")); this.BtnAdd = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "add")); this.TxtResult = WebElement.CreateSelect(this.Browser, this, ElementLocator.Create(By.Id, "result")); }
public void ShouldThrowExceptionWhenTestingEnabledAndElementNotPresent() { var elStatusPage = Browser.Open <ElementStatusPage>(); var unrealElement = WebElement.Create(null, ElementLocator.Create(By.Id, "doesNotExist")); Action checkDisplayed = () => { var displayed = unrealElement.IsEnabled; }; checkDisplayed.Should().Throw <ElementNotFoundException>(); }
public Test000LoginPage(Browser browser) : base(browser, "Virtual Store - Login") { this.TxtUserName = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "userName")); this.TxtPassword = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "password")); this.BtnLogin = WebElement.CreateNavigation <Test000HomePage>(this.Browser, this, ElementLocator.Create(By.Id, "login")); this.DdlCountry = WebElement.CreateSelect(this.Browser, this, ElementLocator.Create(By.Id, "country")); this.DdlCity = WebElement.CreateSelect(this.Browser, this, ElementLocator.Create(By.Id, "city")); this.CtlMenu = WebElement.CreateControl <MenuListItemControl>(this.Browser, this, ElementLocator.Create(By.Id, "menu")); }
public void ShouldHtml5DragAndDropSuccessfuly() { var hoverPage = Browser.Open <DndHtml5Page>(); hoverPage.DivDraggable.DragAndDropTo(hoverPage.DivDropTarget); var droppedElement = WebElement.Create(null, ElementLocator.Create(By.CssSelector, "#div1>#drag1")); Wait.NoMoreThan(TimeSpan.FromSeconds(2)).Until(() => droppedElement.IsAvailable); droppedElement.IsAvailable.Should().BeTrue(); }
public void ShouldWaitForElementToBecomeVisible() { var elStatusPage = Browser.Open <ElementStatusPage>(); var disablingElement = WebElement.Create(null, ElementLocator.Create(By.Id, "willBeDisplayed")); using (var benchmark = new BenchmarkScope("Time Until Display")) { Wait.NoMoreThan(TimeSpan.FromSeconds(3)).Until(() => disablingElement.IsDisplayed); benchmark.Elapsed.Should().BeCloseTo(TimeSpan.FromSeconds(2), 300); } }
public void ShouldWaitForConfirmAndDismiss() { var alertPage = Browser.Open <AlertPage>(); Browser.Click(WebElement.Create(null, ElementLocator.Create(By.LinkText, "Confirm"))); var twoSeconds = TimeSpan.FromSeconds(2); Wait.NoMoreThan(twoSeconds).Until(() => Browser.IsAlertPresent); Browser.IsAlertPresent.Should().BeTrue(); Browser.Alert.Text.Should().Contain("Sunny"); Browser.Alert.Dismiss(); Browser.IsAlertPresent.Should().BeFalse(); }
public void ShouldWaitForAlertAndAccept() { var alertPage = Browser.Open <AlertPage>(); Browser.Click(WebElement.Create(null, ElementLocator.Create(By.ClassName, "alert"))); var twoSeconds = TimeSpan.FromSeconds(2); Wait.NoMoreThan(twoSeconds).Until(() => Browser.IsAlertPresent); Browser.IsAlertPresent.Should().BeTrue(); Browser.Alert.Text.Should().Contain("Servus"); Browser.Alert.Accept(); Browser.IsAlertPresent.Should().BeFalse(); }
public void Issue_11_ShouldNoBlockForLongerThanSpecifiedWhenCallingWaitForNoMoreThan() { var gatewayPage = Browser.Open <Test000GatewayPage>(); var nonExistingElement = WebElement.Create(null, ElementLocator.Create(SpecDrill.SecondaryPorts.AutomationFramework.By.CssSelector, ".abc-xyz")); using (var wait = Browser.ImplicitTimeout(TimeSpan.FromSeconds(3))) using (var benchmark = new BenchmarkScope("timing Wait.NoMoreThan(...)")) { var timeLimit = TimeSpan.FromSeconds(1); Action waitForNonExistingElement = () => Wait.NoMoreThan(timeLimit).Until(() => nonExistingElement.IsAvailable); waitForNonExistingElement.Should().Throw <TimeoutException>(); benchmark.Elapsed.Should().BeCloseTo(timeLimit, 300); } }
public GoogleSearchResultsPage(Browser browser) : base(browser, "") { SearchResults = new ListElement <SearchResultItemControl>(this, ElementLocator.Create(By.CssSelector, "div.content div.mw div.g")); }
public SearchResultItemControl(IBrowser browser, IElement parent, IElementLocator locator) : base(browser, parent, locator) { Link = WebElement.Create(this.Browser, this, ElementLocator.Create(By.CssSelector, "div a")); Description = WebElement.Create(this.Browser, this, ElementLocator.Create(By.CssSelector, "div.rc>div.s>span.st")); }
public MenuListItemControl(IBrowser browser, IElement parent, IElementLocator locator) : base(browser, parent, locator) { LnkLogin = WebElement.CreateNavigation <Test000LoginPage>(browser, parent, ElementLocator.Create(By.PartialLinkText, "Login")); LnkHome = WebElement.CreateNavigation <Test000HomePage>(browser, parent, ElementLocator.Create(By.PartialLinkText, "Home")); }
private void InitFields() { this.TxtSearch = WebElement.Create(this.Browser, this, ElementLocator.Create(By.CssSelector, "input#lst-ib")); this.BtnSearch = WebElement.CreateNavigation <GoogleSearchResultsPage>(this.Browser, this, ElementLocator.Create(By.CssSelector, "button.lsb>span.sbico")); }