-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sendKeys method implementing Mink DriverInterface #302
base: master
Are you sure you want to change the base?
Conversation
src/Selenium2Driver.php
Outdated
$element = $this->findElement($xpath); | ||
$elementName = strtolower($element->name()); | ||
|
||
if ('select' === $elementName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this IF is needed. Instead I'm proposing to allow only these elements in method:
input
HTML elements with specifictype
attribute values (already done)- maybe
textarea
elements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, do we want to accept selects?
If we only leave in the method the "input" IF, textarea input types will be accepted by default.
if (in_array($elementName, array('input', 'textarea'))) { | ||
$existingValueLength = strlen($element->attribute('value')); | ||
$value = str_repeat(Key::BACKSPACE . Key::DELETE, $existingValueLength) . $value; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understood @stof comment (see minkphp/Mink#767 (comment)) correctly, then this should be moved back to setValue
method to allow sendKeys
to send keys (as the name suggests) instead of replacing current input value with provided one (as the setValue
method does).
Implemented method "sendKeys" in order to solve setting a value on autocomplete input elements as commented in 286, 292 and 301
Related to 767 PR open in Mink project.