How can I write a Behat step that will capture a screenshot from the Goutte driver?

StackOverflow https://stackoverflow.com/questions/22637111

  •  21-06-2023
  •  | 
  •  

سؤال

I need to save the HTML in a file somewhere so it can be opened in the browser.

هل كانت مفيدة؟

المحلول

/**
 * @Then /^show me the page$/
 */
public function show_me_the_page() {

    $html = $this->getSession()->getDriver()->getContent();
    file_put_contents('/tmp/behat_page.html', $html);
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top