Skip to content

Commit

Permalink
Merge pull request #3 from Lullabot/justafish-patch-1
Browse files Browse the repository at this point in the history
Use element property for fetching the existing length of an input field
  • Loading branch information
justafish authored Feb 6, 2024
2 parents 2280044 + 5b1098c commit 5566e3f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Selenium2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,12 @@ public function setValue(string $xpath, $value)
$element->postValue(array('text' => Key::DELETE));
}
else {
$existingValueLength = strlen($element->attribute('value'));
if ($this->isW3C()) {
$existingValueLength = strlen($element->property('value'));
}
else {
$existingValueLength = strlen($element->attribute('value'));
}
$value = str_repeat(Key::BACKSPACE . Key::DELETE, $existingValueLength) . $value;
}
}
Expand Down

0 comments on commit 5566e3f

Please sign in to comment.