From c2af41d68ffaaf4727d2afa757df971abc3e1afb Mon Sep 17 00:00:00 2001 From: Sally Young Date: Tue, 6 Feb 2024 15:29:36 +0000 Subject: [PATCH 1/4] Use element property for fetching the existing length of an input field --- src/Selenium2Driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index 86218117..3246ee34 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -750,7 +750,7 @@ public function setValue(string $xpath, $value) $element->postValue(array('text' => Key::DELETE)); } else { - $existingValueLength = strlen($element->attribute('value')); + $existingValueLength = strlen($element->property('value')); $value = str_repeat(Key::BACKSPACE . Key::DELETE, $existingValueLength) . $value; } } From b1257d2beae4f530744b633c8cad6e6fc103df33 Mon Sep 17 00:00:00 2001 From: Sally Young Date: Tue, 6 Feb 2024 15:40:30 +0000 Subject: [PATCH 2/4] Upgrade php-webdriver --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 172f97ef..5b72f5d6 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php": ">=7.2", "ext-json": "*", "behat/mink": "^1.11@dev", - "lullabot/php-webdriver": "^2.0" + "lullabot/php-webdriver": "dev-main" }, "require-dev": { "mink/driver-testsuite": "dev-master", From 9820e09af192b03688f5b9e4088db1ca2f8671a0 Mon Sep 17 00:00:00 2001 From: Sally Young Date: Tue, 6 Feb 2024 15:46:02 +0000 Subject: [PATCH 3/4] Use property only for w3c mode --- src/Selenium2Driver.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index 3246ee34..6f57e679 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -750,7 +750,12 @@ public function setValue(string $xpath, $value) $element->postValue(array('text' => Key::DELETE)); } else { - $existingValueLength = strlen($element->property('value')); + if ($this->isW3C()) { + $existingValueLength = strlen($element->property('value')); + } + else { + $existingValueLength = strlen($element->attribute('value')); + } $value = str_repeat(Key::BACKSPACE . Key::DELETE, $existingValueLength) . $value; } } From 5b1098c53d49ea3de65ba3f49ebda2a19131b69a Mon Sep 17 00:00:00 2001 From: Sally Young Date: Tue, 6 Feb 2024 15:50:56 +0000 Subject: [PATCH 4/4] Set lullabot/php-webdriver back to a release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5b72f5d6..172f97ef 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php": ">=7.2", "ext-json": "*", "behat/mink": "^1.11@dev", - "lullabot/php-webdriver": "dev-main" + "lullabot/php-webdriver": "^2.0" }, "require-dev": { "mink/driver-testsuite": "dev-master",