本文整理汇总了PHP中Facebook\WebDriver\WebDriverBy::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP WebDriverBy::getValue方法的具体用法?PHP WebDriverBy::getValue怎么用?PHP WebDriverBy::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facebook\WebDriver\WebDriverBy
的用法示例。
在下文中一共展示了WebDriverBy::getValue方法的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;
}
示例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;
}
示例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;
}
示例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;
}