"Fossies" - the Fresh Open Source Software Archive

Member "selenium-selenium-4.8.1/dotnet/test/webdriverbackedselenium/TestVisibility.cs" (17 Feb 2023, 3096 Bytes) of package /linux/www/selenium-selenium-4.8.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C# source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 using System;
    2 using NUnit.Framework;
    3 
    4 namespace Selenium.Tests
    5 {
    6     [TestFixture]
    7     public class TestVisibility : SeleniumTestCaseBase
    8     {
    9         [Test]
   10         public void ShouldBeAbleToVerifyVisibility()
   11         {
   12             selenium.Open("../tests/html/test_visibility.html");
   13             Assert.IsTrue(selenium.IsVisible("visibleParagraph"));
   14             Assert.IsFalse(selenium.IsVisible("hiddenParagraph"));
   15             Assert.IsFalse(selenium.IsVisible("suppressedParagraph"));
   16             Assert.IsFalse(selenium.IsVisible("classSuppressedParagraph"));
   17             Assert.IsFalse(selenium.IsVisible("jsClassSuppressedParagraph"));
   18             Assert.IsFalse(selenium.IsVisible("hiddenSubElement"));
   19             Assert.IsTrue(selenium.IsVisible("visibleSubElement"));
   20             Assert.IsFalse(selenium.IsVisible("suppressedSubElement"));
   21             Assert.IsFalse(selenium.IsVisible("jsHiddenParagraph"));
   22             try
   23             {
   24                 Assert.IsFalse(selenium.IsVisible("visibleParagraph"));
   25                 Assert.Fail("expected Assert.Failure");
   26             }
   27             catch (Exception)
   28             {
   29             }
   30             try
   31             {
   32                 Assert.IsTrue(selenium.IsVisible("hiddenParagraph"));
   33                 Assert.Fail("expected Assert.Failure");
   34             }
   35             catch (Exception)
   36             {
   37             }
   38             try
   39             {
   40                 Assert.IsTrue(selenium.IsVisible("suppressedParagraph"));
   41                 Assert.Fail("expected Assert.Failure");
   42             }
   43             catch (Exception)
   44             {
   45             }
   46             try
   47             {
   48                 Assert.IsTrue(selenium.IsVisible("classSuppressedParagraph"));
   49                 Assert.Fail("expected Assert.Failure");
   50             }
   51             catch (Exception)
   52             {
   53             }
   54             try
   55             {
   56                 Assert.IsTrue(selenium.IsVisible("jsClassSuppressedParagraph"));
   57                 Assert.Fail("expected Assert.Failure");
   58             }
   59             catch (Exception)
   60             {
   61             }
   62             try
   63             {
   64                 Assert.IsTrue(selenium.IsVisible("hiddenSubElement"));
   65                 Assert.Fail("expected Assert.Failure");
   66             }
   67             catch (Exception)
   68             {
   69             }
   70             try
   71             {
   72                 Assert.IsTrue(selenium.IsVisible("suppressedSubElement"));
   73                 Assert.Fail("expected Assert.Failure");
   74             }
   75             catch (Exception)
   76             {
   77             }
   78             try
   79             {
   80                 Assert.IsTrue(selenium.IsVisible("jsHiddenParagraph"));
   81                 Assert.Fail("expected Assert.Failure");
   82             }
   83             catch (Exception)
   84             {
   85             }
   86             Assert.IsFalse(selenium.IsVisible("hiddenInput"));
   87             try
   88             {
   89                 Assert.IsTrue(selenium.IsVisible("nonExistentElement"));
   90                 Assert.Fail("expected Assert.Failure");
   91             }
   92             catch (Exception)
   93             {
   94             }
   95         }
   96     }
   97 }