public void ShouldGoToPageEnterTextAndClickButton() { using (var I = new FluentDriver(new FirefoxDriver(null, new FirefoxProfile { EnableNativeEvents = false }))) { I.OpenPage(google); I.EnterText("cats").Into("input[name=\"q\"]"); I.Click().On("input[name=\"btnK\"]"); } }
public void ShouldGoToPageEnterTextClickButtonAndWaitForElementsToAppear() { using (var I = new FluentDriver(new FirefoxDriver(null, new FirefoxProfile { EnableNativeEvents = false }))) { I.OpenPage(google); I.EnterText("cats").Into("input[name=\"q\"]"); Action act = () => I.Expect().ValueOf("input[name=\"q\"]").ToBe("cats"); act.ShouldNotThrow<Exception>(); } }
public void ShouldNotWaitForElementsToAppearAndThrow() { using (var I = new FluentDriver(new FirefoxDriver(null, new FirefoxProfile { EnableNativeEvents = false }))) { I.OpenPage(google); I.EnterText("cats").Into("input[name=\"q\"]"); I.Click().On("input[name=\"btnK\"]"); Action act = () => { I.Expect().ValueOf("lst-ib").ToBe("cats"); }; act.ShouldThrow<Exception>(); } }
public void CanVerifyValueOfTextbox() { using (var I = new FluentDriver(new FirefoxDriver(null, new FirefoxProfile { EnableNativeEvents = false }))) { I.OpenPage(google); I.EnterText("cats").Into("input[name=\"q\"]"); Action toBeAction = () => I.Expect().ValueOf("input[name=\"q\"]").ToBe("cats"); toBeAction.ShouldNotThrow<Exception>(); Action notToBeAction = () => I.Expect().ValueOf("input[name=\"q\"]").NotToBe("dogs"); notToBeAction.ShouldNotThrow<Exception>(); } }
public void ShouldBeAbleToFindAnElement() { var driver = new Mock<IWebDriver>(); var webElement = new Mock<IWebElement>(); webElement.Setup(e => e.SendKeys(It.IsAny<string>())).Verifiable(); driver.Setup(d => d.FindElement(It.IsAny<By>())).Returns(webElement.Object).Verifiable(); using (var I = new FluentDriver(driver.Object)) { I.EnterText("cats").Into("#gbqfq"); } driver.Verify(); webElement.Verify(); }