Получение ошибки при использовании string.Format
errorMessage равно "OpenQA.Selenium.NoSuchElementException: нет такого элемента: невозможно найти элемент: {" method ":" xpath "," selector ":" // div [@ title = 'Клиент n c.'] "}"
код:
errorMessage = (exceptions.CurrentDotNetExceptionMessage.ToString() + "\n" + exceptions.CurrentDotNetInnerException.ToString().Split(new[] { '\r', '\n' }).FirstOrDefault()) ?? string.Empty;
defectDetails = string.Format($"Issue: {actualResult} \n\n" +
$"Steps To Reproduce: \n {stepsToReproduce} \n\n" +
$"Failed Step: \n {failedStep} \n" +
$"Failed Element: \n {failedElement} \n" +
$"Test Data: \n {testData} \n\n" +
$"Actual Result: \n {actualResult} \n" +
$"Expected Result: \n {expectedResult} \n" +
$"Error Message: \n {errorMessage.ToString()} \n\n" +
$"Browser: {browser} \n" +
$"Enviornment: {environment}\n\n" +
$"Stack Trace: {stackTrace}" +
$"\n---------------------------------------------------------------------------------------------------\n\n"
);```
Error Line:
```string.Format($"Error Message: \n {errorMessage} \n");```
Error: string.FormatException