我正在使用 VS2012,我想自定义我的硒测试。
例如,当测试失败时,我想显示文本The page loaded too long - unable to login + original message
而不是只显示这个:OpenQA.Selenium.NoSuchElementException: Unable to find element with id == loginElementID
。可能吗?UI 测试时如何以及何时使用断言?这将使我的测试更容易理解和提供更多信息。
var wait = new WebDriverWait(driver, new TimeSpan(0, 0, 0, 8));
wait.Message = "Page Loaded too long";
或者如何在测试失败时显示 wait.Message ?