当前位置: 首页>>代码示例>>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;未经允许,请勿转载。