当前位置: 首页>>代码示例>>PHP>>正文


PHP Session::start方法代码示例

本文整理汇总了PHP中Behat\Mink\Session::start方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::start方法的具体用法?PHP Session::start怎么用?PHP Session::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Behat\Mink\Session的用法示例。


在下文中一共展示了Session::start方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setUp

 public function setUp()
 {
     parent::setUp();
     $this->driver = new GoutteDriver();
     $this->session = new Session($this->driver);
     $this->session->start();
     $this->session->visit($this->baseUrl);
 }
开发者ID:kratenko,项目名称:oc-server3,代码行数:8,代码来源:AbstractFrontendTest.php

示例3: startSession

 /**
  * Create session.
  *
  * @return void
  */
 protected function startSession()
 {
     if (!$this->session->isStarted()) {
         $this->session->start();
     }
     $this->session->visit($_SERVER['WEB_FIXTURE_URL'] . '/tests/QATools/QATools/Live/PageObject/index.html');
 }
开发者ID:eltonoliveira,项目名称:qa-tools,代码行数:12,代码来源:AbstractLiveTestCase.php

示例4: openPage

 public function openPage($url)
 {
     $session = new Session($this->getDriver());
     $session->start();
     $session->visit($url);
     $this->page = $session->getPage();
 }
开发者ID:manasovdan,项目名称:eTextBookEditor,代码行数:7,代码来源:eTextBookDriver.php

示例5: getMinkSession

 /**
  * Get a Mink session.
  *
  * @return Session
  */
 protected function getMinkSession()
 {
     if (empty($this->session)) {
         $this->session = new Session($this->getMinkDriver());
         $this->session->start();
     }
     return $this->session;
 }
开发者ID:grharry,项目名称:vufind,代码行数:13,代码来源:MinkTestCase.php

示例6: login

 /**
  * @return $session 
  */
 public static function login($username, $password)
 {
     $driver = new GoutteDriver();
     $session = new Session($driver);
     $session->start();
     $session->visit('https://github.com/login');
     $page = $session->getPage();
     $form = $page->find('css', '.auth-form form');
     if (null === $form) {
         throw new \Exception('Couldn\'t locate the login form.');
     }
     $form->fillField('login_field', $username);
     $form->fillField('password', $password);
     $form->submit();
     // @todo need to check if successfully logged in here...
     $dumper = new Dumper();
     file_put_contents(__DIR__ . '/../settings.yml', $dumper->dump(['github' => ['username' => $username, 'password' => $password]], 2));
     return $session;
 }
开发者ID:sebastianwestberg,项目名称:Gitcommander,代码行数:22,代码来源:Auth.php

示例7: checkUserAccessToPages

 /**
  * @param $not
  * @param TableNode $paths
  *
  * @throws \Exception
  *
  * @Given /^user should(| not) have an access to the following pages:$/
  */
 public function checkUserAccessToPages($not, TableNode $paths)
 {
     $result = [];
     $code = $not ? 403 : 200;
     // Use "GoutteDriver" to have an ability to check answer code.
     $driver = new Mink\Driver\GoutteDriver();
     $session = new Mink\Session($driver);
     $session->start();
     foreach (array_keys($paths->getRowsHash()) as $path) {
         $path = trim($path, '/');
         $session->visit($this->locatePath($path));
         if ($session->getStatusCode() !== $code) {
             $result[] = $path;
         }
     }
     if (!empty($result)) {
         throw new \Exception(sprintf('The following paths: "%s" are %s accessible!', implode(', ', $result), $not ? '' : 'not'));
     }
 }
开发者ID:spheresh,项目名称:behat-drupal-propeople-context,代码行数:27,代码来源:RedirectContext.php

示例8: testStart

 public function testStart()
 {
     $this->driver->expects($this->once())->method('start');
     $this->session->start();
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:5,代码来源:SessionTest.php

示例9: _before

 public function _before(TestCase $test)
 {
     $this->session->start();
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:4,代码来源:Mink.php

示例10: _before

 public function _before(\Codeception\TestCase $test)
 {
     $this->session->start();
 }
开发者ID:NaszvadiG,项目名称:ImageCMS,代码行数:4,代码来源:Mink.php

示例11: getSessionFake

 /**
  * @return \Behat\Mink\Session
  */
 public function getSessionFake()
 {
     if (isset($this->fakeSession)) {
         $session = $this->fakeSession();
         //$session->reset();
         return $session;
     }
     $driver = new GoutteDriver();
     $session = new Session($driver);
     $session->start();
     $this->fakeSession = $session;
     return $session;
 }
开发者ID:NuCivic,项目名称:dkanextension,代码行数:16,代码来源:RawDKANContext.php

示例12: Session

<?php

require __DIR__ . '/vendor/autoload.php';
use Behat\Mink\Driver\GoutteDriver;
use Behat\Mink\Driver\Selenium2Driver;
use Behat\Mink\Session;
//$driver = new GoutteDriver();
$driver = new Selenium2Driver();
$session = new Session($driver);
$session->start();
$session->visit('http://jurassicpark.wikia.com');
//echo "The status code is ".$session->getStatusCode()."\n";
echo "The current URL is " . $session->getCurrentUrl() . "\n";
// Hallo! I'm a DocumentElement
$page = $session->getPage();
echo "The start of the page text is " . substr($page->getText(), 0, 56) . "\n";
// And I'm a NodeElement!
$nodeElement = $page->find('css', '.subnav-2 li a');
echo "The matched link text is " . $nodeElement->getText() . "\n";
$randomLink = $page->findLink('Random page');
echo "The matched URL is " . $randomLink->getAttribute('href') . "\n";
$randomLink->click();
echo "The new URL is " . $session->getCurrentUrl() . "\n";
$session->stop();
开发者ID:vinodpanicker,项目名称:behat,代码行数:24,代码来源:mink-playground.php

示例13: iOpenBrowser

 public function iOpenBrowser()
 {
     $driver = new \Behat\Mink\Driver\Selenium2Driver('firefox', array('javascriptEnabled' => true));
     $this->session = new \Behat\Mink\Session($driver);
     $this->session->start();
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:6,代码来源:FeatureContext.php

示例14: setUp

 public function setUp()
 {
     $driver = new \Behat\Mink\Driver\GoutteDriver();
     $this->session = new \Behat\Mink\Session($driver);
     $this->session->start();
 }
开发者ID:rpkamp,项目名称:rafflers,代码行数:6,代码来源:Raffler.php


注:本文中的Behat\Mink\Session::start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。