public function extract()
 {
     if (!$this->webDriver->elementExists($this->theme->getAddToCartXpath(), 'byXpath')) {
         throw new NoSuchElementException('Could not find the simple add to cart element with the Xpath: ' . $this->theme->getAddToCartXpath());
     }
     $this->element = $this->webDriver->byXpath($this->theme->getAddToCartXpath());
 }
 public function extract()
 {
     if (!$this->webDriver->elementExists($this->theme->getAddToCartXpath(), 'byXpath')) {
         throw new NoSuchElementException('Could not find the simple add to cart element with the Xpath: ' . $this->theme->getAddToCartXpath());
     }
     $elements = $this->webDriver->findElements(WebDriverBy::xpath($this->theme->getAddToCartXpath()));
     foreach ($elements as $element) {
         if ($element->isDisplayed()) {
             $this->element = $element;
             return;
         }
     }
 }
 public function extract()
 {
     $this->items = [];
     $labelXpath = $this->theme->getConfigurableLabelXpath();
     $elements = $this->webDriver->findElements(WebDriverBy::xpath($labelXpath));
     foreach ($elements as $count => $element) {
         // Gotta do this because the text is an unencapsulated DOMText node in Magento 1 (properly done in M2)
         $doc = new \DOMDocument();
         $html = trim($element->getAttribute('innerHTML'));
         if ($html != htmlspecialchars($html)) {
             $doc->loadHTML($html);
             $xpath = new \DOMXPath($doc);
             $elements = $xpath->query('//text()');
             $name = null;
             foreach ($elements as $e) {
                 /* @var $e \DOMText */
                 // text nodes that are not encapsulated by a tag have a nodeName of "body"
                 if ($e->parentNode->nodeName == 'body') {
                     $testName = $this->theme->filterConfigurableProductOptionName(trim($e->nodeValue));
                     if ($testName) {
                         $name = $testName;
                     }
                 }
             }
         } else {
             $name = $html;
         }
         if ($name === null) {
             throw new MissingSwatchNameException('Unable to extract the swatch name from HTML: ' . $element->getAttribute('innerHTML'));
         }
         $isSwatch = $this->swatchProcessor->isConfigurableSwatch($count + 1);
         if ($isSwatch) {
             $this->items[] = $this->swatchProcessor->process($name, $count + 1);
         } else {
             // gotta find some way to do this recursively, the options are populated based off of previous option selections
             $this->items[] = $this->standardProcessor->process($name, $count + 1);
         }
     }
 }
 public function extract()
 {
     $testXpath = $this->theme->getSearchSuggestionTextXpath(1);
     $this->webDriver->wait(5)->until(ExpectedCondition::elementExists($testXpath, WebDriver::BY_XPATH));
     $testElement = $this->webDriver->byXpath($testXpath);
     $this->webDriver->wait(5)->until(ExpectedCondition::visibilityOf($testElement));
     $count = 0;
     $this->suggestions = [];
     while ($this->webDriver->elementExists($this->theme->getSearchSuggestionTextXpath(++$count), WebDriver::BY_XPATH)) {
         $suggestionCount = trim($this->webDriver->byXpath($this->theme->getSearchSuggestionCountXpath($count))->getText());
         $suggestionText = trim($this->webDriver->byXpath($this->theme->getSearchSuggestionTextXpath($count))->getText());
         $suggestionText = trim($suggestionText, $suggestionCount);
         $this->suggestions[] = new SearchSuggestion($this->webDriver->byXpath($this->theme->getSearchSuggestionTextXpath($count)), $suggestionCount, $suggestionText);
     }
 }
 public function extract()
 {
     if (!$this->element instanceof WebDriverElement || !$this->webDriver->elementAttached($this->element)) {
         $this->element = $this->webDriver->byXpath($this->theme->getBreadCrumbXpath());
     }
 }