Assert in Selenium C#

后端 未结 8 757
[愿得一人]
[愿得一人] 2021-01-07 11:45

Is there a Assert class present in Selenium C# just like we have in Coded UI test.

Or I should use the Microsoft.VisualStudio.TestTools.UnitTesting.Asser

8条回答
  •  北海茫月
    2021-01-07 11:58

    Assert.Equals(obj1, obj2); // Object comparison
    Assert.AreEqual(HomeUrl, driver.Url); // Overloaded, comparison. Same object value
    Assert.AreNotEqual(HomeUrl, driver.Url);
    Assert.AreSame("https://www.google.com", URL); // For the same object reference
    
    Assert.IsTrue(driver.WindowHandles.Count.Equals(2));
    Assert.IsFalse(driver.WindowHandles.Count.Equals(2));
    
    Assert.IsNull(URL); Assert.IsNotNull(URL);
    

提交回复
热议问题