Mink
Mink copied to clipboard
Add sendKeys method
Added method in order to solve setting a value on autocomplete input elements as commented in 286, 292 and 301
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
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)
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?
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
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. We can discuss it here
@JordiGiros if you test things for a complex JS widget, you might want to see what happens when writing fr
in the field, and then continuing writing to reach fran
. If we force to set the value, emptying the field first (which is what https://github.com/minkphp/MinkSelenium2Driver/pull/302 is doing currently), you cannot test that (as your second call would erase everything and then write fran
, which is a different usage pattern).
As the intended usage of this method is to be able to test such JS-based UIs, we should make it as usable as possible for that.
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?
https://github.com/minkphp/Mink/pull/767#issuecomment-431032401
@JordiGiros , I've specified a place in https://github.com/minkphp/MinkSelenium2Driver/pull/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 https://github.com/minkphp/Mink/pull/767#issuecomment-431020462 .