How can i render webform on custom url with custom html in drupal 8 Basically I am using sample code which shown in below.

public function test(){

$webform = \Drupal::entityTypeManager()-&gt;getStorage('webform')-&gt;load('contact_us');
$webform = $webform-&gt;getSubmissionForm();
$dd= drupal_render($webform);

return array(
'#type'=&gt; 'markup',
'#markup' =&gt; $dd.'&lt;div&gt;&lt;p&gt;test&lt;/p&gt;&lt;/div&gt;'

);

}


I'm using return type markup then form is not rendering properly.So any help available. Thank you all in advance.
This should work if you return $webform; without rendering. Or use the webform render element, then you don't need to load the form:

return [
  'test1' =&gt; ['#markup' =&gt; '&lt;div&gt;&lt;p&gt;test1&lt;/p&gt;&lt;/div&gt;'],
  'form' =&gt; [
    '#type' =&gt; 'webform',
    '#webform' =&gt; 'webform_id',
  ],
  'test2' =&gt; ['#markup' =&gt; '&lt;div&gt;&lt;p&gt;test2&lt;/p&gt;&lt;/div&gt;'],
];