diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index b5e05ee..46deafc 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -2213,7 +2213,7 @@ protected function checkForMetaRefresh() {
    */
   protected function drupalHead($path, array $options = array(), array $headers = array()) {
     $options['absolute'] = TRUE;
-    $url = $this->container->get('url_generator')->generateFromPath($path, $options);
+    $url = $this->buildUrl($path, $options);
     $out = $this->curlExec(array(CURLOPT_NOBODY => TRUE, CURLOPT_URL => $url, CURLOPT_HTTPHEADER => $headers));
     // Ensure that any changes to variables in the other thread are picked up.
     $this->refreshVariables();
@@ -2669,7 +2669,7 @@ protected function assertUrl($path, array $options = array(), $message = '', $gr
     }
     else {
       $options['absolute'] = TRUE;
-      $url = $this->container->get('url_generator')->generateFromPath($path, $options);
+      $url = $this->buildUrl($path, $options);
     }
     if (!$message) {
       $message = SafeMarkup::format('Expected @url matches current URL (@current_url).', array(
@@ -2925,7 +2925,7 @@ protected function buildUrl($path, array $options = array()) {
     // interactive installer tests.
     else if ($this->container->has('url_generator')) {
       $options['absolute'] = TRUE;
-      return $this->container->get('url_generator')->generateFromPath($path, $options);
+      return $this->container->get('url_generator')->generateFromRoute($path, $options);
     }
     else {
       return $this->getAbsoluteUrl($path);
