I want to build an automation testing, so I have to know the errors that appear in the console of chrome.
there is an option to get the error lines that appear in th
Here is a solution to get Chrome logs using the C#, Specflow and Selenium 4.0.0-alpha05. Pay attention that the same code doesn't work with Selenium 3.141.0.
[AfterScenario]
public void AfterScenario(ScenarioContext context)
{
if (context.TestError != null)
{
GetChromeLogs(context); //Chrome logs are taken only if test fails
}
Driver.Quit();
}
private void GetChromeLogs()
{
var chromeLogs = Driver.Manage().Logs.GetLog(LogType.Browser).ToList();
}