diff --git a/core/tests/Drupal/TestTools/Extension/HtmlLogging/HtmlOutputLogger.php b/core/tests/Drupal/TestTools/Extension/HtmlLogging/HtmlOutputLogger.php
index 10a8f5a49b61f232b1731c3c822f911537853d63..ada2cc74ea25ae5a0f04be2a2986721eaf19bfbb 100644
--- a/core/tests/Drupal/TestTools/Extension/HtmlLogging/HtmlOutputLogger.php
+++ b/core/tests/Drupal/TestTools/Extension/HtmlLogging/HtmlOutputLogger.php
@@ -79,7 +79,7 @@ public static function isEnabled(): bool {
    * Logs a link to a generated HTML page.
    *
    * @param string $logEntry
-   *   A link to a generated HTML page.
+   *   A link to a generated HTML page, should not contain a trailing newline.
    *
    * @throws \RuntimeException
    */
diff --git a/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php b/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php
index 35400a5c90eb7e0efacb53697830f43478de0cc9..f61073e51c76e28d6ac98feaa0dc74bc7fabebea 100644
--- a/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php
+++ b/core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php
@@ -118,7 +118,7 @@ protected function htmlOutput($message = NULL) {
     // Do not use the file_url_generator service as the module_handler service
     // might not be available.
     $uri = $this->htmlOutputBaseUrl . '/sites/simpletest/browser_output/' . $html_output_filename;
-    HtmlOutputLogger::log($uri . "\n");
+    HtmlOutputLogger::log($uri);
   }
 
   /**