public void ShouldThrowExceptionWhenSearchContextDoesNotWrapDriver(string rawSelector) { var element = new SearchContextBuilder().AsWebElement().Build(); var sut = By.SizzleSelector(rawSelector); ((Action)(() => sut.FindElement(element))).Should().Throw <InvalidCastException>(); }
public void ShouldThrowExceptionWhenSearchContextIsNotWebElement(string rawSelector) { var driver = new WebDriverBuilder().WithSizzleLoaded().WithElementLocatedBySizzle(rawSelector) .WithElementLocatedBySizzle($"body > {rawSelector}").WithPathToElement(rawSelector) .Build(); var element = new SearchContextBuilder().WithWrappedDriver(driver).Build(); var sut = By.SizzleSelector(rawSelector); ((Action)(() => sut.FindElement(element))).Should().Throw <NotSupportedException>(); }
public void ShouldFindElementWithNestedSizzleSelector(string rawSelector) { var driver = new WebDriverBuilder().WithSizzleLoaded().WithElementLocatedBySizzle(rawSelector) .WithElementLocatedBySizzle($"body > {rawSelector}").WithPathToElement(rawSelector) .Build(); var element = new SearchContextBuilder().AsWebElement().WithWrappedDriver(driver).Build(); var sut = By.SizzleSelector(rawSelector); var result = sut.FindElement(element); result.Should().NotBeNull(); }
public void ShouldFindElementWithNestedJQuerySelector(string rawSelector) { var driver = new WebDriverBuilder().WithJQueryLoaded().WithElementLocatedByJQuery(rawSelector) .WithElementLocatedByJQuery($"body > {rawSelector}").WithPathToElement(rawSelector) .Build(); var element = new SearchContextBuilder().AsWebElement().WithWrappedDriver(driver).Build(); var selector = JQuerySelector(rawSelector); var sut = selector.FindElement(element); sut.Should().NotBeNull(); }
public void ShouldThrowExceptionWhenSearchContextDoesNotWrapDriver(string rawSelector) { // Arrange var element = new SearchContextBuilder().ThatIsWebElement().Build(); var selector = By.SizzleSelector(rawSelector); // Act Action action = () => selector.FindElement(element); // Assert action.ShouldThrow<NotSupportedException>(); }
public void ShouldThrowExceptionWhenSearchContextIsNotWebElement(string rawSelector) { // Arrange var driver = new WebDriverBuilder().ThatHasSizzleLoaded().ThatContainsElementLocatedBySizzle(rawSelector) .ThatContainsElementLocatedBySizzle($"body > {rawSelector}").ThatCanResolvePathToElement(rawSelector) .Build(); var element = new SearchContextBuilder().WithWrappedDriver(driver).Build(); var selector = By.SizzleSelector(rawSelector); // Act Action action = () => selector.FindElement(element); // Assert action.ShouldThrow<NotSupportedException>(); }
public void ShouldFindElementWithNestedSizzleSelector(string rawSelector) { // Arrange var driver = new WebDriverBuilder().ThatHasSizzleLoaded().ThatContainsElementLocatedBySizzle(rawSelector) .ThatContainsElementLocatedBySizzle($"body > {rawSelector}").ThatCanResolvePathToElement(rawSelector) .Build(); var element = new SearchContextBuilder().WithWrappedDriver(driver).ThatIsWebElement().Build(); var selector = By.SizzleSelector(rawSelector); // Act var result = selector.FindElement(element); // Assert result.Should().NotBeNull(); }