本文整理匯總了PHP中Shopware\Tests\Mink\Helper::getRequiredSelector方法的典型用法代碼示例。如果您正苦於以下問題:PHP Helper::getRequiredSelector方法的具體用法?PHP Helper::getRequiredSelector怎麽用?PHP Helper::getRequiredSelector使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Shopware\Tests\Mink\Helper
的用法示例。
在下文中一共展示了Helper::getRequiredSelector方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCurrentLanguage
/**
* Returns the current language
* Use this only for asserts. If you only need the current language, use Helper::getCurrentLanguage().
* @return string
*/
public function getCurrentLanguage()
{
$languageKeys = array(1 => 'de', 2 => 'en');
$languages = $this->findAll('css', Helper::getRequiredSelector($this, 'languages'));
/** @var Element $language */
foreach ($languages as $language) {
if ($language->getAttribute('selected')) {
return $languageKeys[$language->getAttribute('value')];
}
}
return 'de';
}
示例2: checkCaptcha
/**
* Checks, whether a captcha exists and has loaded correctly
* @throws \Exception
*/
public function checkCaptcha()
{
$placeholderSelector = Helper::getRequiredSelector($this, 'captchaPlaceholder');
if (!$this->getSession()->wait(5000, "\$('{$placeholderSelector}').children().length > 0")) {
$message = 'The captcha was not loaded or does not exist!';
Helper::throwException($message);
}
$element = Helper::findElements($this, ['captchaPlaceholder', 'captchaImage', 'captchaHidden']);
$captchaPlaceholder = $element['captchaPlaceholder']->getAttribute('data-src');
$captchaImage = $element['captchaImage']->getAttribute('src');
$captchaHidden = $element['captchaHidden']->getValue();
if (strpos($captchaPlaceholder, '/widgets/Captcha/refreshCaptcha') === false || strpos($captchaImage, 'data:image/png;base64') === false || empty($captchaHidden)) {
$message = 'The captcha was not loaded correctly!';
Helper::throwException($message);
}
}
示例3: noElement
/**
* @param string $locator
* @param bool $throwException
* @return bool
*/
public function noElement($locator, $throwException = true)
{
if (Helper::getRequiredSelector($this, $locator)) {
//previous or next
$result = Helper::countElements($this, $locator);
} else {
//page number (1, 2, 3, 4, ...)
$result = !$this->hasLink($locator);
}
if ($result === true) {
return true;
}
if ($throwException) {
$message = sprintf('The Paging Link "%s" exists, but should not!', $locator);
Helper::throwException($message);
}
return false;
}
示例4: getTextProperty
/**
* Returns the text preview of the blog article
* @param NodeElement $article
* @return null|string
*/
public function getTextProperty(NodeElement $article)
{
$selector = Helper::getRequiredSelector($this, 'articleText');
return $article->find('css', $selector)->getText();
}
示例5: checkEsdArticles
/**
* Helper method checks the ESD articles
* @param string $date
* @param array $articles
* @throws \Exception
*/
private function checkEsdArticles($date, array $articles)
{
$esd = array();
foreach ($articles as $key => $article) {
if (empty($article['esd'])) {
continue;
}
$esd[] = $article['product'];
}
if (empty($esd)) {
return;
}
$language = Helper::getCurrentLanguage($this);
Helper::clickNamedLink($this, 'myEsdDownloads', $language);
$locators = array('esdDownloads');
$elements = Helper::findAllOfElements($this, $locators);
$locator = Helper::getRequiredSelector($this, 'esdDownloadName');
$downloads = array();
/** @var NodeElement $esdDownload */
foreach ($elements['esdDownloads'] as $esdDownload) {
if (strpos($esdDownload->getText(), $date) !== false) {
$downloads[] = $this->find('css', $locator)->getText();
}
}
foreach ($esd as $givenEsd) {
foreach ($downloads as $download) {
if ($givenEsd === $download) {
break;
}
if ($download === end($downloads)) {
$message = sprintf('ESD-Article "%s" not found in account!', $givenEsd);
Helper::throwException($message);
}
}
}
}
示例6: getSlideProperty
/**
* Default method to get a slide property
* @param NodeElement $slide
* @param string $property
* @return null|string
*/
public function getSlideProperty(NodeElement $slide, $property)
{
$selector = Helper::getRequiredSelector($this, 'slide' . $property);
return $slide->find('css', $selector)->getText();
}
示例7: getLinkProperty
/**
* @param NodeElement $slide
* @return string
*/
public function getLinkProperty(NodeElement $slide)
{
$selector = Helper::getRequiredSelector($this, 'slideLink');
return $slide->find('css', $selector)->getAttribute('href');
}
示例8: getPriceProperty
/**
* Returns the price
* @param NodeElement $slide
* @return float
*/
public function getPriceProperty(NodeElement $slide)
{
$selector = Helper::getRequiredSelector($this, 'slidePrice');
$price = $slide->find('css', $selector)->getText();
return Helper::floatValue($price);
}
示例9: getTitleProperty
/**
* Returns the title-attribute of the slide
* @param NodeElement $slide
* @return string|null
*/
protected function getTitleProperty(NodeElement $slide)
{
$selector = Helper::getRequiredSelector($this, 'slideImage');
return $slide->find('css', $selector)->getAttribute('title');
}
示例10: getPriceProperty
/**
* Returns the price
* @param NodeElement $slide
* @return float
*/
public function getPriceProperty(NodeElement $slide)
{
$selector = Helper::getRequiredSelector($this, 'slidePrice');
preg_match('(\\d+,\\d{2})', $slide->find('css', $selector)->getHtml(), $price);
return Helper::floatValue(current($price));
}