Skip to content

Conversation

@JordiGiros
Copy link

@JordiGiros JordiGiros commented Oct 18, 2018

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.

$element = $this->findElement($xpath);
$elementName = strtolower($element->name());

if ('select' === $elementName) {
Copy link
Member

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 specific type attribute values (already done)
  • maybe textarea elements

Copy link
Author

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.

@JordiGiros JordiGiros changed the title Add setAutocompleteValue implementing Mink DriverInterface Add sendKeys method implementing Mink DriverInterface Nov 5, 2018
Comment on lines +1233 to +1236
if (in_array($elementName, array('input', 'textarea'))) {
$existingValueLength = strlen($element->attribute('value'));
$value = str_repeat(Key::BACKSPACE . Key::DELETE, $existingValueLength) . $value;
}
Copy link
Member

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).

edosenseidotcom added a commit to edosenseidotcom/MinkSelenium2Driver that referenced this pull request Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants