-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Webpage.uploadFile not working in phantomjs 2.0 #12506
Comments
This is a known regression. |
What is causing this issue? I'd like to contribute a fix but not sure where to start. |
Looks like I was able to track down the cause of the regression issue and I found a suitable workaround (although I'm not sure its the proper fix long-term). Basically, a change made in Qt 4.8 and incorporated subsequently in Qt 5.0 prevented clicking on file input elements that were not caused by user gestures. The following patch to comment out the 2 relevant lines in src/qt/qtwebkit/Source/WebCore/html/FileInputType.cpp circumvents that and allows file uploads to work with Phantom 2. I was able to comment those 2 lines and rebuilding Phantom 2 from source.
Here's the bug that tipped me off to the underlying cause. Originally the filtering of clicks for user gestures was done in Source/WebCore/rendering/RenderFIleUploadControl.cpp in the ::click() method but this revision refactored that functionality out and put in FileInputType.cpp. Since this is a patch, I'm not sure how such things should be handled long-term (i.e. to ensure the patch is re-applied with newer updates to QtWebKit pulled into this repository). |
Yes burkestar this works. I also recompile from the source code Thanks. |
fixes issue ariya#12506 ariya#12506 Since phantomJS is a headless browser, evaluating if the gesture comes from a user is pointless. The UserGestureIndicator is now a dummy class that always returns true.
This has solved the issue for me as well. Thank you @burkestar 👍 |
It would be great to get a fix for this rolled into upstream Qt. We had originally filed a bug in WebKit here: https://bugs.webkit.org/show_bug.cgi?id=75385. It was closed when all Qt related bugs were bulk closed in the WebKit bug tracker. In capybara-webkit, we work around this by using native clicks to submit file uploads. |
fwiw, poltergeist spec showing the error if anyone was looking for a cheap way to repro: teampoltergeist/poltergeist#585 |
I've tried javascript code example from this issue in phantomjs 2 which is published on your website and upload file is not working. Was it fixed at all? |
The patch worked for me ! I can now upload via webdriver ! Thank you @burkestar |
Works for me too. Thanks @burkestar! |
Just updating that this isn't fixed in the latest version installed by Seems like we need to patch QT upstream? https://bugs.webkit.org/show_bug.cgi?id=75385 doesn't necessarily seem appropriate, since it was file in 2012 and this issue only just surfaced? |
Have there been any updates to fix this besides the patch? |
👍 |
1 similar comment
👍 |
I forked and made the update and it works great for me if anyone wants to build the binary off of my fork: https://github.com/stevepm/phantomjs/tree/2.0 |
Is it possible to merge your fix to the main repository? Which commit fixes this issue? Thanks |
Yes, 2.0.1 version will receive this fix |
Hi @stevepm , do you have a windows binary of your fork? (https://github.com/stevepm/phantomjs/tree/2.0) Could you share it? |
I have Ubuntu/Arch/OSX binaries @ https://github.com/skakri/phantomjs/releases/tag/2.0.1-regression-12506 , if someone needs those. |
Thanks @skakri, your build have the patch for upload file gesture 👍 i´ll try to build on the weekend. |
@leopucci if you manage to build it on Windows x68_64, feel free to send me a link to binary @ kristaps.karlsons@gmail.com. I'll add it to downloads. |
Ok! :) 🎱 |
Hey, has a windows patch for the upload file bug been created? Could someone direct me to the patch this will be extremely helpful! |
I compiled a binary for ubuntu 12.04 64bit using the source from @skakri on https://github.com/skakri/phantomjs/releases/tag/2.0.1-regression-12506 I have uploaded the binary on https://github.com/cantonic/phantomjs/releases/tag/2.0.1-regression-12506 |
Sorry i did not had time to compile for windows yet as i told. |
@skakri Thanks for sharing the source. My colleague compiled it for windows, binary is on Dropbox here: https://www.dropbox.com/s/u71vipap8bnm72u/windows-x86_64-phantomjs.exe?dl=0 |
@samir-mahendra – thanks, added. @cantonic sorry, I've compiled it for Ubuntu 14.04. |
@samir-mahendra Thanks!! |
still not working. |
@geminiyellow Can you give more details on which OS you are using, and the specific test that fails for you? The test script I used to test if it's working is below. You have to run it as follows: phantomjs --ssl-protocol=any testscript.js You can then check if the file got uploaded by going to: https://encodable.com/uploaddemo/?action=listfiles
|
+1 |
Please stop spamming "+1", it adds clutter. |
We have a proposal fix for this issue. And it will be landed in 2.0.1. Thanks for your patience. |
Fixed in master. |
This is in linux (Ubuntu)
The result on phantomjs 1.9.7 is
while 2.0 is
another important thing is that it is never fired onFilePicker
The text was updated successfully, but these errors were encountered: