From 94b72ad6922f4a1ee3a0b6fcef9a612a852a20cc Mon Sep 17 00:00:00 2001 From: JoppeDC Date: Thu, 25 Jul 2024 09:49:07 +0200 Subject: [PATCH 1/2] Add WaitForClickable helper --- src/Client.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Client.php b/src/Client.php index e2885092..237cda65 100644 --- a/src/Client.php +++ b/src/Client.php @@ -507,6 +507,23 @@ public function waitForDisabled(string $locator, int $timeoutInSecond = 30, int return $this->crawler = $this->createCrawler(); } + /** + * @param string $locator The path to the element that will be disabled. Can be a CSS selector or Xpath expression. + * + * @throws NoSuchElementException + * @throws TimeoutException + */ + public function waitForClickable(string $locator, int $timeoutInSecond = 30, int $intervalInMillisecond = 250): PantherCrawler + { + $by = self::createWebDriverByFromLocator($locator); + + $this->wait($timeoutInSecond, $intervalInMillisecond)->until( + WebDriverExpectedCondition::elementToBeClickable($by) + ); + + return $this->crawler = $this->createCrawler(); + } + public function getWebDriver(): WebDriver { $this->start(); From 96b95fc122d55e9438f0d8dec5bebe05da54d618 Mon Sep 17 00:00:00 2001 From: Joppe De Cuyper Date: Sat, 7 Dec 2024 12:20:04 +0100 Subject: [PATCH 2/2] Revert "Add WaitForClickable helper" This reverts commit 94b72ad6922f4a1ee3a0b6fcef9a612a852a20cc. --- src/Client.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/Client.php b/src/Client.php index 6bba9c55..84a5d2bd 100644 --- a/src/Client.php +++ b/src/Client.php @@ -507,23 +507,6 @@ public function waitForDisabled(string $locator, int $timeoutInSecond = 30, int return $this->crawler = $this->createCrawler(); } - /** - * @param string $locator The path to the element that will be disabled. Can be a CSS selector or Xpath expression. - * - * @throws NoSuchElementException - * @throws TimeoutException - */ - public function waitForClickable(string $locator, int $timeoutInSecond = 30, int $intervalInMillisecond = 250): PantherCrawler - { - $by = self::createWebDriverByFromLocator($locator); - - $this->wait($timeoutInSecond, $intervalInMillisecond)->until( - WebDriverExpectedCondition::elementToBeClickable($by) - ); - - return $this->crawler = $this->createCrawler(); - } - public function getWebDriver(): WebDriver { $this->start();