本文整理汇总了C#中Element.WaitUntilExists方法的典型用法代码示例。如果您正苦于以下问题:C# Element.WaitUntilExists方法的具体用法?C# Element.WaitUntilExists怎么用?C# Element.WaitUntilExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Element
的用法示例。
在下文中一共展示了Element.WaitUntilExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WaitUntilExistsTimeOutExceptionInnerExceptionNotSetToLastExceptionThrown
public void WaitUntilExistsTimeOutExceptionInnerExceptionNotSetToLastExceptionThrown()
{
var domContainerMock = new Mock<DomContainer>( new object[] { });
var finderMock = new ElementFinderMock();
var counter = 0;
finderMock.FindAllElements = () =>
{
counter++;
if (counter == 1) throw new UnauthorizedAccessException("");
return new List<Element>();
};
var element1 = new Element(domContainerMock.Object, finderMock);
Exceptions.TimeoutException timeoutException = null;
try
{
element1.WaitUntilExists(1);
}
catch (Exceptions.TimeoutException e)
{
timeoutException = e;
}
Assert.IsNotNull(timeoutException, "TimeoutException not thrown");
Assert.IsNull(timeoutException.InnerException, "Unexpected innerexception");
domContainerMock.VerifyAll();
}
示例2: WaitUntilExistsTimeOutExceptionInnerExceptionSetToLastExceptionThrown
public void WaitUntilExistsTimeOutExceptionInnerExceptionSetToLastExceptionThrown()
{
var domContainerMock = new Mock<DomContainer>(new object[] { });
var finderMock = new ElementFinderMock();
var counter = 0;
finderMock.FindAllElements = () =>
{
counter++;
if (counter == 1) throw new Exception("");
throw new UnauthorizedAccessException("mockUnauthorizedAccessException");
};
element = new Element(domContainerMock.Object, finderMock);
Exceptions.TimeoutException timeoutException = null;
try
{
element.WaitUntilExists(1);
}
catch (Exceptions.TimeoutException e)
{
timeoutException = e;
}
Assert.IsNotNull(timeoutException, "TimeoutException not thrown");
Assert.IsInstanceOfType(typeof (UnauthorizedAccessException), timeoutException.InnerException, "Unexpected innerexception");
Assert.AreEqual("mockUnauthorizedAccessException", timeoutException.InnerException.Message);
domContainerMock.VerifyAll();
}
示例3: WaitUntilElementExistsTimeOutException
public void WaitUntilElementExistsTimeOutException()
{
// GIVEN
var elementFinderMock = new ElementFinderMock
{
FindAllElements = (() => new List<Element> {(Element) null})
};
var element1 = new Element(new Mock<DomContainer>().Object, elementFinderMock);
// WHEN
element1.WaitUntilExists(1);
// THEN exception
}