只要输入错误的密码,我就需要截图。
namespace UITest.
{
[TestClass]
public class Firefox
{
[TestMethod]
public void AMDP()
{
Driver.Navigate().GoToUrl("https://Google.de");
Driver.Manage().Window.Maximize();
//Add Username
Thread.Sleep(waitingTime);
Driver.FindElement(SoeUser).SendKeys("TestUser");
// Add password
Thread.Sleep(waitingTime);
Driver.FindElement(SoePW).SendKeys("Testpw");
}
}
}我的代码看起来像这样
发布于 2022-08-15 12:55:26
试试这个:
public void TakeScreenshot(IWebDriver driver,string pathWithFileName)
{
try
{
((ITakesScreenshot)driver).GetScreenshot().SaveAsFile(pathWithFileName, ScreenshotImageFormat.Png);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
throw;
}
}https://stackoverflow.com/questions/73360856
复制相似问题