"Fossies" - the Fresh Open Source Software Archive

Member "selenium-selenium-4.8.1/dotnet/test/common/ElementPropertyTest.cs" (17 Feb 2023, 1081 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 System.Collections.Generic;
    3 using NUnit.Framework;
    4 using System.Collections.ObjectModel;
    5 using OpenQA.Selenium.Environment;
    6 
    7 namespace OpenQA.Selenium
    8 {
    9     [TestFixture]
   10     public class ElementPropertyTest : DriverTestFixture
   11     {
   12         [Test]
   13         [IgnoreBrowser(Browser.Remote)]
   14         public void ShouldReturnNullWhenGettingTheValueOfAPropertyThatIsNotListed()
   15         {
   16             driver.Url = simpleTestPage;
   17             IWebElement head = driver.FindElement(By.XPath("/html"));
   18             string attribute = head.GetDomProperty("cheese");
   19             Assert.That(attribute, Is.Null);
   20         }
   21 
   22         [Test]
   23         [IgnoreBrowser(Browser.Remote)]
   24         public void CanRetrieveTheCurrentValueOfAProperty()
   25         {
   26             driver.Url = formsPage;
   27             IWebElement element = driver.FindElement(By.Id("working"));
   28             Assert.AreEqual(string.Empty, element.GetDomProperty("value"));
   29             element.SendKeys("hello world");
   30             Assert.AreEqual("hello world", element.GetDomProperty("value"));
   31         }
   32     }
   33 }