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


PHP WebDriverBy::getMechanism方法代码示例

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


在下文中一共展示了WebDriverBy::getMechanism方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findElement

 /**
  * Sub class of RemoteWebDriver. Overloading its findElement method
  * to make use of RefreshingWebDriverElement.
  */
 public function findElement(WebDriverBy $by)
 {
     // This method is similar to RemoteWebDriver::findElement() but
     // returns an instance of RefreshingWebElement.
     $params = array('using' => $by->getMechanism(), 'value' => $by->getValue());
     $raw_element = $this->execute(DriverCommand::FIND_ELEMENT, $params);
     // Create a RefreshingWebElement and set resources needed to let the
     // element refresh in the future.
     $element = new RefreshingWebElement($this->getExecuteMethod(), $raw_element['ELEMENT']);
     $element->setLocator($by);
     $element->setWebDriver($this);
     return $element;
 }
开发者ID:LOVDnl,项目名称:LOVD3,代码行数:17,代码来源:LOVDWebDriver.php

示例2: findElements

 /**
  * Find all WebDriverElements within the current page using the given
  * mechanism.
  *
  * @param WebDriverBy $by
  * @return RemoteWebElement[] A list of all WebDriverElements, or an empty
  *    array if nothing matches
  * @see WebDriverBy
  */
 public function findElements(WebDriverBy $by)
 {
     $params = array('using' => $by->getMechanism(), 'value' => $by->getValue());
     $raw_elements = $this->execute(DriverCommand::FIND_ELEMENTS, $params);
     $elements = array();
     foreach ($raw_elements as $raw_element) {
         $elements[] = $this->newElement($raw_element['ELEMENT']);
     }
     return $elements;
 }
开发者ID:boots7458,项目名称:elabftw,代码行数:19,代码来源:RemoteWebDriver.php

示例3: _waitUntil

 /**
  * Main method to handle waits. All public accessible methods in this trait delegates to this method
  * to handle the waiting process with the same algorithm. When the timeout is reached an error gets handled
  * automatically. After the waiting process, the test case will continue.
  *
  * @param string      $type        Whether displayed, enabled or selected.
  * @param WebDriverBy $by          WebDriverBy instance to locate the expected element.
  * @param int         $timeOut     Timeout to wait, when the amount (in seconds) is reached, the test case fails.
  * @param int         $interval    Interval of repeating the waiting condition.
  * @param bool        $expectation Possibility to negate the wait condition.
  *
  * @return $this Same instance for chained method calls.
  */
 private function _waitUntil($type, WebDriverBy $by, $timeOut = 30, $interval = 250, $expectation = true)
 {
     if ($this->isFailed()) {
         return $this;
     }
     if ($type !== 'displayed' && $type !== 'enabled' && $type !== 'selected') {
         throw new \InvalidArgumentException('the $type argument has to be whether "displayed", "enabled" or ' . '"selected"');
     }
     $this->output('Wait ' . $timeOut . ' seconds until an element with ' . $by->getMechanism() . ' "' . $by->getValue() . '" is ' . $type);
     $expectMethod = 'expectsToBe' . ucfirst($type);
     try {
         $this->getWebDriver()->wait($timeOut, $interval)->until(function () use($by, $expectMethod, $expectation) {
             return call_user_func([$this, $expectMethod], $by) === $expectation;
         });
     } catch (TimeOutException $e) {
         $msg = $by->getMechanism() . ' "' . $by->getValue() . '" not found in ' . $timeOut . ' seconds.';
         $this->output($msg);
         $this->exceptionError($msg, $e);
     }
     return $this;
 }
开发者ID:AlcyZ,项目名称:GX-Selenium-Framework,代码行数:34,代码来源:WaitProviderTrait.php

示例4: findElement

 /**
  * @param WebDriverBy $by
  * @return \Facebook\WebDriver\Remote\RemoteWebElement
  */
 public function findElement(WebDriverBy $by)
 {
     $this->logFind($by->getMechanism(), $by->getValue());
     $element = parent::findElement($by);
     $this->logElement($element);
     return $element;
 }
开发者ID:magium,项目名称:magium,代码行数:11,代码来源:WebDriver.php


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