You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1) Behat\Mink\Tests\Driver\Js\ChangeEventTest::testSetValueChangeEvent with data set "file" ('the-file', 'from empty', 'from existing')
Zumba\GastonJS\Exception\JavascriptError: One or more errors were raised in the Javascript code on the page.
If you don't care about these errors, you can ignore them by
setting js_errors: false in your Poltergeist configuration (see documentation for details).
InvalidStateError: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable.
InvalidStateError: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable.
at phantomjs://code/agent.js:465 in set
at :187 in textAreaSetValue
at :175 in inputSetValue
at :201
at :211
at :212
at :212
/Users/juan/code/scm/opensource/pjsdriver/vendor/jcalderonzumba/gastonjs/src/Browser/BrowserBase.php:119
/Users/juan/code/scm/opensource/pjsdriver/vendor/jcalderonzumba/gastonjs/src/Browser/BrowserBase.php:99
/Users/juan/code/scm/opensource/pjsdriver/vendor/jcalderonzumba/gastonjs/src/Browser/BrowserScriptTrait.php:16
/Users/juan/code/scm/opensource/pjsdriver/src/FormManipulationTrait.php:39
/Users/juan/code/scm/opensource/pjsdriver/vendor/behat/mink/src/Element/NodeElement.php:105
/Users/juan/code/scm/opensource/pjsdriver/vendor/mink/driver-testsuite/tests/Js/ChangeEventTest.php:50```
I can add more info.
The error seems to be on the file check, you gotta remember that phantomjs is like a real browser so you can not just call setValue for "input type file" as that is a completely different thing and phantomjs provides native methods to really input a file.
@jcalderonzumba well, you could handle it by moving some logic at the driver level for setValue instead of putting the whole logic in a JS block executed client-side. Selenium also requires a special code path for file uploads, but our Driver::setValue implementation takes care of this.
That's a good point. i'll add that in the todo. However the test itself is actually setting a string the file value, don't think that is accurate at least not for "real browsers"
@jcalderonzumba the value passed to Driver::setValue for a file field is the path to a file, because this is a sensible way to provide a file to the driver (we could pass it a File value object encapsulating the path, but I don't see the benefit).
We never said that this getter was equivalent to setting the value property in the DOM in Javascript (otherwise, it would not have support for select and radio/checkboxes either), and so I don't see the point of comparing it to what happens for "real browsers". This API is for people using Mink to say I want to put this value in the field, take care of it internally depending on the type of field so that I don't have to take care myself.
I understand that and that's why in my case is done on JS stuff (i need to change that to handle files properly).
My comment was actually focused on the test itself in this part:
on the file => array(...)
Should my implementation just ignore when a file value is not a file path and silently return a success? (once again, just asking opinion as i need to modify my driver).
Activity
jcalderonzumba commentedon Nov 22, 2016
I can add more info.
The error seems to be on the file check, you gotta remember that phantomjs is like a real browser so you can not just call setValue for "input type file" as that is a completely different thing and phantomjs provides native methods to really input a file.
stof commentedon Nov 22, 2016
@jcalderonzumba well, you could handle it by moving some logic at the driver level for
setValueinstead of putting the whole logic in a JS block executed client-side. Selenium also requires a special code path for file uploads, but ourDriver::setValueimplementation takes care of this.jcalderonzumba commentedon Nov 22, 2016
That's a good point. i'll add that in the todo. However the test itself is actually setting a string the file value, don't think that is accurate at least not for "real browsers"
stof commentedon Nov 22, 2016
@jcalderonzumba the value passed to
Driver::setValuefor a file field is the path to a file, because this is a sensible way to provide a file to the driver (we could pass it a File value object encapsulating the path, but I don't see the benefit).We never said that this getter was equivalent to setting the
valueproperty in the DOM in Javascript (otherwise, it would not have support for select and radio/checkboxes either), and so I don't see the point of comparing it to what happens for "real browsers". This API is for people using Mink to sayI want to put this value in the field, take care of it internally depending on the type of field so that I don't have to take care myself.jcalderonzumba commentedon Nov 22, 2016
I understand that and that's why in my case is done on JS stuff (i need to change that to handle files properly).
My comment was actually focused on the test itself in this part:
on the file => array(...)
Should my implementation just ignore when a file value is not a file path and silently return a success? (once again, just asking opinion as i need to modify my driver).
Use canonical path for file input value
robertfausk commentedon Mar 29, 2019
I think this can be closed regarding merged PR #26.