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; } } }