-
Notifications
You must be signed in to change notification settings - Fork 280
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 #767
base: master
Are you sure you want to change the base?
Add sendKeys method #767
Conversation
src/Driver/CoreDriver.php
Outdated
*/ | ||
public function setAutocompleteValue($xpath, $value) | ||
{ | ||
throw new UnsupportedDriverActionException('Setting the field value is not supported by %s', $this); |
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.
I think, that error message should mention, that value is set into an auto-complete field.
I don't think the method name is right. This method should be about typing in a field, not about setting a value IMO. It is not only about autocomplete |
Note that if we make it a method typing something in the field, we should probably not force emptying first (as that removes control from the user about what gets actually typed in the field) |
This would make it map to https://www.w3.org/TR/webdriver1/#element-send-keys |
Emptying first as in setValue method? Why not? The behaviour should be nearly the same but without triggering any "change event" and staying the focus in the element. Does this apply here or is a problem we should discus in MinkSelenium2 project? |
Ok, I agree. We can name it "sendKeys()" following W3 naming. But then, in selenium2 driver should we send alls the keys passed to sendKeys() method using keyPress() in loop or we will use postValue()? In fact in Selenium2Driver->setValue() we already use the method postValue() that basically sends a sequence of key strokes to an element. |
@JordiGiros if you test things for a complex JS widget, you might want to see what happens when writing |
We also need a method on NodeElement |
And we need a PR on the driver-testsuite repository with functional tests using this new API, to cover the expected behavior of drivers (otherwise, there is no interoperability between drivers) |
Yes, I see. So not deleting previous string would be a better solution. I'll change that on selenium2driver. |
Any update on this? |
@JordiGiros , I've specified a place in minkphp/MinkSelenium2Driver#302 that needs to be changed to implement this. Also I wasn't able to find associated PR in the test suite, that @stof mentioned in #767 (comment) . |
* @throws UnsupportedDriverActionException When operation not supported by the driver | ||
* @throws DriverException When the operation cannot be done | ||
* | ||
* @see \Behat\Mink\Element\NodeElement::setAutocompleteValue |
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.
Are you sure, that mentioned method exists?
Added method in order to solve setting a value on autocomplete input elements as commented in 286, 292 and 301