diff --git a/dotnet/test/common/VisibilityTest.cs b/dotnet/test/common/VisibilityTest.cs index d01a878ccb3a4..836cc57d05384 100644 --- a/dotnet/test/common/VisibilityTest.cs +++ b/dotnet/test/common/VisibilityTest.cs @@ -77,7 +77,7 @@ public void ShouldNotBeAbleToClickOnAnElementThatIsNotDisplayed() { driver.Url = javascriptPage; IWebElement element = driver.FindElement(By.Id("unclickable")); - Assert.Throws(() => element.Click()); + Assert.That(() => element.Click(), Throws.InstanceOf()); } [Test] @@ -86,7 +86,7 @@ public void ShouldNotBeAbleToTypeAnElementThatIsNotDisplayed() { driver.Url = javascriptPage; IWebElement element = driver.FindElement(By.Id("unclickable")); - Assert.Throws(() => element.SendKeys("You don't see me")); + Assert.That(() => element.SendKeys("You don't see me"), Throws.InstanceOf()); Assert.AreNotEqual(element.GetAttribute("value"), "You don't see me"); } @@ -97,7 +97,7 @@ public void ShouldNotBeAbleToSelectAnElementThatIsNotDisplayed() { driver.Url = javascriptPage; IWebElement element = driver.FindElement(By.Id("untogglable")); - Assert.Throws(() => element.Click()); + Assert.That(() => element.Click(), Throws.InstanceOf()); } [Test]