From d284c62ae59c3f20b78e827cf5dccb11258a0e47 Mon Sep 17 00:00:00 2001 From: TakeAChef <93644533+TakeAChef@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:08:21 +0200 Subject: [PATCH] Update Selenium2Driver.php The error "invalid argument: 'id' can not be string" is thrown when passing a numeric iframe index to the method switchToIframe, because is casted to string. The package "instaclick/php-webdriver" throws a 500 error in CurlService. Passing ['id' => integer] here $this->getWebDriverSession()->frame(array('id' => $name)); solves the problem. That's the reason why i suggest typing switchToIFrame with integer (apart from string and null). --- src/Selenium2Driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index 3f2d1c39..1fce3fc2 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -435,7 +435,7 @@ public function switchToWindow(?string $name = null) $this->getWebDriverSession()->focusWindow($name ?: ''); } - public function switchToIFrame(?string $name = null) + public function switchToIFrame(string|int|null $name = null) { $this->getWebDriverSession()->frame(array('id' => $name)); }