Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SearchResultsTitle.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Block\Block;
10 use Magento\Mtf\Client\Locator;
11 
15 class SearchResultsTitle extends Block
16 {
22  protected $searchResultsFor = '[data-ui-id="page-title-wrapper"]';
23 
29  public function getSearchQuery()
30  {
31  $searchQueryResult = $this->_rootElement->find(sprintf($this->searchResultsFor), Locator::SELECTOR_CSS)
32  ->getText();
33  preg_match("~Search results for: \'(.*)\'~", $searchQueryResult, $matches);
34  $query = isset($matches[1]) ? $matches[1] : null;
35  return $query;
36  }
37 }