From 374bafe7875338a250ee6eb4e8017dcf68932240 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 22 Feb 2024 12:46:06 +0200 Subject: [PATCH 1/2] Allow specify frame index in the "switchToIFrame" driver method --- src/WebdriverClassicDriver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WebdriverClassicDriver.php b/src/WebdriverClassicDriver.php index 2d4ba13..2348f8b 100644 --- a/src/WebdriverClassicDriver.php +++ b/src/WebdriverClassicDriver.php @@ -186,10 +186,10 @@ public function switchToWindow(?string $name = null): void $this->getWebDriver()->switchTo()->window((string)$name); } - public function switchToIFrame(?string $name = null): void + public function switchToIFrame($name = null): void { $frameQuery = $name; - if ($name && $this->getWebDriver()->isW3cCompliant()) { + if ($name && !is_numeric($name) && $this->getWebDriver()->isW3cCompliant()) { try { $frameQuery = $this->getWebDriver()->findElement(WebDriverBy::id($name)); } catch (NoSuchElementException $e) { From 541f367945b4f0eba3d4326af62b2cd662e7a3c2 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 22 Feb 2024 13:09:45 +0200 Subject: [PATCH 2/2] Use "is_int" instead of "is_numeric" for frame index detection --- src/WebdriverClassicDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebdriverClassicDriver.php b/src/WebdriverClassicDriver.php index 2348f8b..61363f1 100644 --- a/src/WebdriverClassicDriver.php +++ b/src/WebdriverClassicDriver.php @@ -189,7 +189,7 @@ public function switchToWindow(?string $name = null): void public function switchToIFrame($name = null): void { $frameQuery = $name; - if ($name && !is_numeric($name) && $this->getWebDriver()->isW3cCompliant()) { + if ($name && !is_int($name) && $this->getWebDriver()->isW3cCompliant()) { try { $frameQuery = $this->getWebDriver()->findElement(WebDriverBy::id($name)); } catch (NoSuchElementException $e) {