From b5b18bd2e02b35a14c7085552780588b8876460b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 18 Apr 2022 00:43:56 +0200 Subject: [PATCH] Fix compatibility with Selenium 2.x --- lib/WebDriver/Session.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/WebDriver/Session.php b/lib/WebDriver/Session.php index d4b3268..f73e379 100644 --- a/lib/WebDriver/Session.php +++ b/lib/WebDriver/Session.php @@ -476,7 +476,13 @@ private function serializeArguments(array $arguments) foreach ($arguments as $key => $value) { // Potential compat-buster, i.e., W3C-specific if ($value instanceof Element) { - $arguments[$key] = [Container::WEBDRIVER_ELEMENT_ID => $value->getID()]; + // preferably we want to detect W3C support and never set nor parse + // LEGACY_ELEMENT_ID, until detection is implemented, serialize to both + // variants, tested with Selenium v2.53.1 and v3.141.59 + $arguments[$key] = [ + Container::WEBDRIVER_ELEMENT_ID => $value->getID(), + Container::LEGACY_ELEMENT_ID => $value->getID(), + ]; continue; }