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


PHP Session::getPage方法代碼示例

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


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

示例1: login

 /**
  * helper method for pages which needs an active login
  *
  * @throws ElementNotFoundException
  *
  * @return void
  */
 protected function login()
 {
     $page = $this->session->getPage();
     $page->fillField('email', 'root');
     $page->fillField('password', 'developer');
     $page->pressButton('Anmelden');
 }
開發者ID:kratenko,項目名稱:oc-server3,代碼行數:14,代碼來源:AbstractFrontendTest.php

示例2: getMessageElement

 /**
  * @return NodeElement
  *
  * @throws ElementNotFoundException
  */
 private function getMessageElement()
 {
     $messageElement = $this->session->getPage()->find('css', self::NOTIFICATION_ELEMENT_CSS);
     if (null === $messageElement) {
         throw new ElementNotFoundException($this->session->getDriver(), 'message element', 'css', self::NOTIFICATION_ELEMENT_CSS);
     }
     return $messageElement;
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:13,代碼來源:NotificationAccessor.php

示例3: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->page = $this->prophesize(DocumentElement::class);
     $this->session = $this->prophesize(Session::class);
     $this->session->getPage()->willReturn($this->page->reveal());
     $this->webAssert = $this->prophesize(WebAssert::class);
 }
開發者ID:DrupalCamp-NYC,項目名稱:dcnyc16,代碼行數:11,代碼來源:AssertLegacyTraitTest.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: dontSeeInTitle

 public function dontSeeInTitle($title)
 {
     $el = $this->session->getPage()->find('css', 'title');
     if (!$el) {
         return $this->assertTrue(true);
     }
     $this->assertNotContains($title, $el->getText(), "page title contains {$title}");
 }
開發者ID:lenninsanchez,項目名稱:donadores,代碼行數:8,代碼來源:Mink.php

示例6: dontSeeInField

 /**
  * Checks the value in field is not equal to value passed.
  * Field is searched by its id|name|label|value or CSS selector.
  *
  * @param $field
  * @param $value
  */
 public function dontSeeInField($field, $value)
 {
     $node = $this->session->getPage()->findField($field);
     if (!$node) {
         return \PHPUnit_Framework_Assert::fail(", field not found");
     }
     \PHPUnit_Framework_Assert::assertNotEquals($this->escape($value), $node->getValue());
 }
開發者ID:nike-17,項目名稱:Codeception,代碼行數:15,代碼來源:Mink.php

示例7: iAmOn

 /**
  * @Given /^I am on "([^"]*)"$/
  */
 public function iAmOn($arg1)
 {
     if (!$this->session) {
         $this->iOpenBrowser();
     }
     $url = $arg1;
     $this->session->visit($url);
     $this->page = $this->session->getPage();
 }
開發者ID:Niggu,項目名稱:cloudrexx,代碼行數:12,代碼來源:FeatureContext.php

示例8: checkSelectContainsOption

 /**
  * Check if a select has an option.
  * 
  * @param string $select
  * @param string $option
  *
  * @return bool True if the option found in the select, else false
  */
 protected function checkSelectContainsOption($select, $option)
 {
     $obj = $this->session->getPage()->findField($select);
     if ($obj === null) {
         throw new \Exception(sprintf('Select box "%s" not found', $select));
     }
     $optionText = $obj->getText();
     $regex = '/' . preg_quote($option, '/') . '/ui';
     return preg_match($regex, $optionText) > 0;
 }
開發者ID:totaltrash,項目名稱:symfony-testing,代碼行數:18,代碼來源:WebAssert.php

示例9: tryRecordTabsOnId

 /**
  * Test record tabs for a particular ID.
  *
  * @param Session $session  Session
  * @param string  $id       ID to load
  * @param bool    $encodeId Should we URL encode the ID?
  *
  * @return void
  */
 protected function tryRecordTabsOnId(Session $session, $id, $encodeId = true)
 {
     $url = $this->getVuFindUrl('/Record/' . ($encodeId ? rawurlencode($id) : $id));
     $session->visit($url);
     $this->assertEquals(200, $session->getStatusCode());
     $page = $session->getPage();
     $staffViewTab = $page->findById('details');
     $this->assertTrue(is_object($staffViewTab));
     $this->assertEquals('Staff View', $staffViewTab->getText());
     $staffViewTab->click();
     $this->assertEquals($url . '#details', $session->getCurrentUrl());
     $staffViewTable = $page->find('css', '#details-tab table.citation');
     $this->assertTrue(is_object($staffViewTable));
     $this->assertEquals('LEADER', substr($staffViewTable->getText(), 0, 6));
 }
開發者ID:joemontibello,項目名稱:vufind,代碼行數:24,代碼來源:RecordTest.php

示例10: 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

示例11: grabTextFrom

 public function grabTextFrom($cssOrXPathOrRegex)
 {
     $el = null;
     if (Locator::isCSS($cssOrXPathOrRegex)) {
         $el = $this->session->getPage()->find('css', $cssOrXPathOrRegex);
         if ($el) {
             return $el->getText();
         }
     }
     if (!$el and Locator::isXPath($cssOrXPathOrRegex)) {
         $el = @$this->session->getPage()->find('xpath', $cssOrXPathOrRegex);
         if ($el) {
             return $el->getText();
         }
     }
     if (@preg_match($cssOrXPathOrRegex, $this->session->getPage()->getContent(), $matches)) {
         return $matches[1];
     }
     throw new ElementNotFound($cssOrXPathOrRegex, 'CSS or XPath or Regex');
 }
開發者ID:NaszvadiG,項目名稱:ImageCMS,代碼行數:20,代碼來源:Mink.php

示例12: grabTextFrom

 public function grabTextFrom($cssOrXPathOrRegex)
 {
     $el = null;
     try {
         $el = $this->session->getPage()->find('css', $cssOrXPathOrRegex);
     } catch (\Symfony\Component\CssSelector\Exception\ParseException $e) {
     }
     if ($el) {
         return $el->getText();
     }
     if (!$el) {
         $el = @$this->session->getPage()->find('xpath', $cssOrXPathOrRegex);
     }
     if ($el) {
         return $el->getText();
     }
     if (@preg_match($cssOrXPathOrRegex, $this->session->getPage()->getContent(), $matches)) {
         return $matches[1];
     }
     $this->fail("Element that matches '{$cssOrXPathOrRegex}' not found");
 }
開發者ID:pfz,項目名稱:codeception,代碼行數:21,代碼來源:Mink.php

示例13: 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

示例14: wasPostRequest

 /**
  * If this was a POST request - we send something to the #extra_msg container
  *
  * @return bool
  */
 protected function wasPostRequest()
 {
     $extraMsg = $this->session->getPage()->find('css', '#extra_msg')->getText();
     return !empty($extraMsg);
 }
開發者ID:usetreno,項目名稱:JsFormValidatorBundle,代碼行數:10,代碼來源:BaseMinkTestCase.php

示例15: iShouldGet

 /**
  * @Then I should get :expectedString
  */
 public function iShouldGet($expectedString)
 {
     $body = $this->session->getPage()->getContent();
     PHPUnit_Framework_Assert::assertEquals($expectedString, unserialize($body));
 }
開發者ID:sam-burns,項目名稱:psr7-symfony-httpfoundation,代碼行數:8,代碼來源:WebserverContext.php


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