asm*_*sma 6 c# automated-tests c#-4.0 selenium-webdriver
我几乎搜索了与Selenium WebDriver相关的每个论坛/网站,但仍无法找到如何使用C#在Selenium WebDriver中使用断言和验证的解决方案.
这是我的代码,我只想在下面编写的代码中放置一个示例断言.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
namespace Healthfleet
{
class Login
{
static void Main(string[] args)
{
IWebDriver driver = new ChromeDriver(@"D:\Downloads");
driver.Navigate().GoToUrl("https://test.com/");
IWebElement username = driver.FindElement(By.Id("username"));
IWebElement password = driver.FindElement(By.Id("password"));
username.SendKeys("test@test.test");
password.SendKeys("test");
IWebElement loginButton = driver.FindElement(By.Id("Login"));
loginButton.Click();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我需要使用断言来检查username = test是否存在,但是我无法找到任何Assert类或方法.
我错过了一些包含Assert类或任何其他想法的命名空间吗?