當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Session::getScreenshot方法代碼示例

本文整理匯總了PHP中Behat\Mink\Session::getScreenshot方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::getScreenshot方法的具體用法?PHP Session::getScreenshot怎麽用?PHP Session::getScreenshot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Behat\Mink\Session的用法示例。


在下文中一共展示了Session::getScreenshot方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _shoot_shot

 /**
  *
  * @param \Pachico\Voyeur\Shot $shot
  * @return string
  */
 protected function _shoot_shot(Shot $shot)
 {
     // Starting sesion if not started yet (in short, open browser)
     if (!$this->_session->isStarted()) {
         $this->_log_out('Starting camera session');
         $this->_session->start();
     }
     $this->_log_out('Loading ' . $shot->get_uri());
     $this->_log_out("Resizing window to " . $shot->get_width() . 'x' . $shot->get_height());
     $this->_session->resizeWindow($shot->get_width(), $shot->get_height());
     // Load page
     $this->_session->visit($shot->get_uri());
     $this->_log_out("Loading finished");
     // Should I wait for something?
     if (count($shot->get_wait_for()) > 0) {
         foreach ($shot->get_wait_for() as $waitings) {
             $wait_time = key($waitings);
             $condition = is_null(current($waitings)) ? null : current($waitings);
             $this->_log_out("Waiting " . $wait_time . ' microseconds');
             $condition and $this->_log_out("Or until " . $condition);
             $this->_session->wait($wait_time, $condition);
         }
     }
     // Any scripts to execute?
     if (count($shot->get_scripts()) > 0) {
         foreach ($shot->get_scripts() as $script) {
             $script = $this->_get_script_file_content($script);
             $this->_session->executeScript($script);
         }
     }
     // Finally take the screenshot and return it
     $this->_log_out("Taking screenshot");
     $picture = $this->_session->getScreenshot();
     return $picture;
 }
開發者ID:pachico,項目名稱:voyeur,代碼行數:40,代碼來源:Voyeur.php

示例2: makeScreenshot

 protected function makeScreenshot()
 {
     if (empty($this->session)) {
         return 'No session';
     }
     try {
         $name = date('Y-m-d_H:i:s') . '.png';
         file_put_contents('/tmp/' . $name, $this->session->getScreenshot());
         $imageUrl = $this->getUploader()->upload('/tmp/' . $name);
     } catch (\Exception $e) {
         $imageUrl = $e->getMessage();
     }
     return $imageUrl;
 }
開發者ID:usetreno,項目名稱:JsFormValidatorBundle,代碼行數:14,代碼來源:BaseMinkTestCase.php

示例3: testGetScreenshot

 public function testGetScreenshot()
 {
     $this->driver->expects($this->once())->method('getScreenshot')->will($this->returnValue('screenshot'));
     $this->assertEquals('screenshot', $this->session->getScreenshot());
 }
開發者ID:saberyounis,項目名稱:Sonata-Project,代碼行數:5,代碼來源:SessionTest.php

示例4: initializeSessionStub

 private function initializeSessionStub(Session $session)
 {
     $session->getScreenshot()->willReturn('binary-image');
 }
開發者ID:elvetemedve,項目名稱:behat-screenshot,代碼行數:4,代碼來源:ScreenshotTakerSpec.php


注:本文中的Behat\Mink\Session::getScreenshot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。