From f629824a3fe18c7a1bb1938bc23bf543546ad34a Mon Sep 17 00:00:00 2001 From: Kevin Schroeder Date: Tue, 21 Feb 2017 08:24:12 -0600 Subject: [PATCH] Added a wait condition to make sure that the button for the search is clickable. There may be some customizations where the search button is disabled until text is entered. So, to make it slightly easier, I've added a wait in there. This change should be inconsequential 99.9% of the time. --- lib/Magento/Actions/Search/Search.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Magento/Actions/Search/Search.php b/lib/Magento/Actions/Search/Search.php index ec4f024..51c8054 100644 --- a/lib/Magento/Actions/Search/Search.php +++ b/lib/Magento/Actions/Search/Search.php @@ -2,8 +2,10 @@ namespace Magium\Magento\Actions\Search; +use Facebook\WebDriver\WebDriverBy; use Magium\Actions\WaitForPageLoaded; use Magium\Magento\Themes\AbstractThemeConfiguration; +use Magium\WebDriver\ExpectedCondition; use Magium\WebDriver\WebDriver; class Search @@ -27,7 +29,9 @@ public function __construct( public function search($characters) { $this->type($characters); - $element = $this->webDriver->byXpath($this->theme->getSearchSubmitXpath()); + $searchButtonXpath = $this->theme->getSearchSubmitXpath(); + $element = $this->webDriver->byXpath($searchButtonXpath); + $this->webDriver->wait()->until(ExpectedCondition::elementToBeClickable(WebDriverBy::xpath($searchButtonXpath))); $element->click(); $this->loaded->execute($element); } @@ -41,4 +45,4 @@ public function type($characters, $clear = false) $box->sendKeys($characters); } -} \ No newline at end of file +}