Skip to content
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

File upload no longer works with geckodriver 0.18.0 and Firefox 55 #858

Closed
twalpole opened this issue Aug 7, 2017 · 32 comments
Closed

File upload no longer works with geckodriver 0.18.0 and Firefox 55 #858

twalpole opened this issue Aug 7, 2017 · 32 comments
Assignees

Comments

@twalpole
Copy link

twalpole commented Aug 7, 2017

System

  • Version: 0.18.0
  • Platform: Linux/macOS
  • Firefox: 55.0
  • Selenium: selenium-webdriver 3.4.3

Setting a file to an <input type="file"> element fails with a InvalidArgumentError - "File not found".
This previously worked with geckodriver 0.17.0 and FF 54. The file definitely exists

Trace-level log

2017-08-07 12:45:56 INFO Selenium -> POST session/052205fa-96a1-2f41-aaf8-f9ad91b6b0ba/element/e8d21000-d1cf-bc47-97a7-478b10a02ae9/value
2017-08-07 12:45:56 INFO Selenium    >>> http://127.0.0.1:4444/session/052205fa-96a1-2f41-aaf8-f9ad91b6b0ba/element/e8d21000-d1cf-bc47-97a7-478b10a02ae9/value | {"value":["/","U","s","e","r","s","/","t","w","a","l","p","o","l","e","/","P","r","o","j","e","c","t","s","/","j","n","i","c","k","l","a","s","-","c","a","p","y","b","a","r","a","/","l","i","b","/","c","a","p","y","b","a","r","a","/","s","p","e","c","/","s","e","s","s","i","o","n","/","a","t","t","a","c","h","_","f","i","l","e","_","s","p","e","c",".","r","b"],"text":"/Users/twalpole/Projects/jnicklas-capybara/lib/capybara/spec/session/attach_file_spec.rb"}
2017-08-07 12:45:56 DEBUG Selenium      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=utf-8", "Content-Length"=>"461"}
1502135156958	webdriver::server	DEBUG	-> POST /session/052205fa-96a1-2f41-aaf8-f9ad91b6b0ba/element/e8d21000-d1cf-bc47-97a7-478b10a02ae9/value {"value":["/","U","s","e","r","s","/","t","w","a","l","p","o","l","e","/","P","r","o","j","e","c","t","s","/","j","n","i","c","k","l","a","s","-","c","a","p","y","b","a","r","a","/","l","i","b","/","c","a","p","y","b","a","r","a","/","s","p","e","c","/","s","e","s","s","i","o","n","/","a","t","t","a","c","h","_","f","i","l","e","_","s","p","e","c",".","r","b"],"text":"/Users/twalpole/Projects/jnicklas-capybara/lib/capybara/spec/session/attach_file_spec.rb"}
1502135156966	geckodriver::marionette	TRACE	-> 532:[0,10,"sendKeysToElement",{"id":"e8d21000-d1cf-bc47-97a7-478b10a02ae9","text":"/Users/twalpole/Projects/jnicklas-capybara/lib/capybara/spec/session/attach_file_spec.rb","value":["/","U","s","e","r","s","/","t","w","a","l","p","o","l","e","/","P","r","o","j","e","c","t","s","/","j","n","i","c","k","l","a","s","-","c","a","p","y","b","a","r","a","/","l","i","b","/","c","a","p","y","b","a","r","a","/","s","p","e","c","/","s","e","s","s","i","o","n","/","a","t","t","a","c","h","_","f","i","l","e","_","s","p","e","c",".","r","b"]}]
1502135156967	Marionette	TRACE	0 -> [0,10,"sendKeysToElement",{"id":"e8d21000-d1cf-bc47-97a7-478b10a02ae9","text":"/Users/twalpole/Projects/jnicklas-capybara/lib/capybara/spec/session/attach_file_spec.rb","value":["/","U","s","e","r","s","/","t","w","a","l","p","o","l","e","/","P","r","o","j","e","c","t","s","/","j","n","i","c","k","l","a","s","-","c","a","p","y","b","a","r","a","/","l","i","b","/","c","a","p","y","b","a","r","a","/","s","p","e","c","/","s","e","s","s","i","o","n","/","a","t","t","a","c","h","_","f","i","l","e","_","s","p","e","c",".","r","b"]}]
1502135156974	Marionette	TRACE	0 <- [1,10,{"error":"invalid argument","message":"File not found: /Users/twalpole/Projects/jnicklas-capybara/lib/capybara/spec/session/attach_file_spec.rb","stacktrace":"WebDriverError@chrome://marionette/content/error.js:222:5\nInvalidArgumentError@chrome://marionette/content/error.js:325:5\ninteraction.uploadFile@chrome://marionette/content/interaction.js:350:11\nTaskImpl_run@resource://gre/modules/Task.jsm:321:42\n"},null]
1502135156984	geckodriver::marionette	TRACE	<- [1,10,{"error":"invalid argument","message":"File not found: /Users/twalpole/Projects/jnicklas-capybara/lib/capybara/spec/session/attach_file_spec.rb","stacktrace":"WebDriverError@chrome://marionette/content/error.js:222:5\nInvalidArgumentError@chrome://marionette/content/error.js:325:5\ninteraction.uploadFile@chrome://marionette/content/interaction.js:350:11\nTaskImpl_run@resource://gre/modules/Task.jsm:321:42\n"},null]
1502135156991	webdriver::server	DEBUG	<- 400 Bad Request {"value":{"error":"invalid argument","message":"File not found: /Users/twalpole/Projects/jnicklas-capybara/lib/capybara/spec/session/attach_file_spec.rb","stacktrace":"stack backtrace:\n   0:        0x10f223f64 - backtrace::backtrace::trace::h381bd5461b44fdf8\n   1:        0x10f22431e - backtrace::capture::Backtrace::new::hbc1a12654c8fdba8\n   2:        0x10f1502ad - webdriver::error::WebDriverError::new::h482125abced50b28\n   3:        0x10f15c11f - geckodriver::marionette::MarionetteSession::response::hc90b9b3424fb8183\n   4:        0x10f16928b - geckodriver::marionette::MarionetteConnection::send_command::he82b7344fb11a670\n   5:        0x10f15ad38 - _$LT$geckodriver..marionette..MarionetteHandler$u20$as$u20$webdriver..server..WebDriverHandler$LT$geckodriver..marionette..GeckoExtensionRoute$GT$$GT$::handle_command::hf2128d0e5b79de64\n   6:        0x10f0fabe8 - _$LT$webdriver..server..Dispatcher$LT$T$C$$u20$U$GT$$GT$::run::h03cbe31ad3bffc79\n   7:        0x10f15104a - webdriver::server::start::_$u7b$$u7b$closure$u7d$$u7d$::h39b3aa32dda07c86\n   8:        0x10f14534a - _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::hdf61d260d4895572\n   9:        0x10f089399 - std::panicking::try::do_call::h7b2d8948e219fc68\n  10:        0x10f6ba01a - __rust_maybe_catch_panic\n  11:        0x10f088eac - std::panicking::try::h91913aec898bbfef\n  12:        0x10f0863c5 - std::panic::catch_unwind::h3ab5cba0644d3617\n  13:        0x10f08817c - std::thread::Builder::spawn::_$u7b$$u7b$closure$u7d$$u7d$::h27cd13f9efbf7439\n  14:        0x10f0e3686 - _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::hc399e39818c3f4d8\n  15:        0x10f6b61e4 - std::sys::imp::thread::Thread::new::thread_start::h36f6d218784ec55f\n  16:     0x7fffaaf2393a - _pthread_body\n  17:     0x7fffaaf23886 - _pthread_start"}}
2017-08-07 12:45:56 INFO Selenium <- {"value":{"error":"invalid argument","message":"File not found: /Users/twalpole/Projects/jnicklas-capybara/lib/capybara/spec/session/attach_file_spec.rb","stacktrace":"stack backtrace:\n   0:        0x10f223f64 - backtrace::backtrace::trace::h381bd5461b44fdf8\n   1:        0x10f22431e - backtrace::capture::Backtrace::new::hbc1a12654c8fdba8\n   2:        0x10f1502ad - webdriver::error::WebDriverError::new::h482125abced50b28\n   3:        0x10f15c11f - geckodriver::marionette::MarionetteSession::response::hc90b9b3424fb8183\n   4:        0x10f16928b - geckodriver::marionette::MarionetteConnection::send_command::he82b7344fb11a670\n   5:        0x10f15ad38 - _$LT$geckodriver..marionette..MarionetteHandler$u20$as$u20$webdriver..server..WebDriverHandler$LT$geckodriver..marionette..GeckoExtensionRoute$GT$$GT$::handle_command::hf2128d0e5b79de64\n   6:        0x10f0fabe8 - _$LT$webdriver..server..Dispatcher$LT$T$C$$u20$U$GT$$GT$::run::h03cbe31ad3bffc79\n   7:        0x10f15104a - webdriver::server::start::_$u7b$$u7b$closure$u7d$$u7d$::h39b3aa32dda07c86\n   8:        0x10f14534a - _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::hdf61d260d4895572\n   9:        0x10f089399 - std::panicking::try::do_call::h7b2d8948e219fc68\n  10:        0x10f6ba01a - __rust_maybe_catch_panic\n  11:        0x10f088eac - std::panicking::try::h91913aec898bbfef\n  12:        0x10f0863c5 - std::panic::catch_unwind::h3ab5cba0644d3617\n  13:        0x10f08817c - std::thread::Builder::spawn::_$u7b$$u7b$closure$u7d$$u7d$::h27cd13f9efbf7439\n  14:        0x10f0e3686 - _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::hc399e39818c3f4d8\n  15:        0x10f6b61e4 - std::sys::imp::thread::Thread::new::thread_start::h36f6d218784ec55f\n  16:     0x7fffaaf2393a - _pthread_body\n  17:     0x7fffaaf23886 - _pthread_start"}}
@Pilleo
Copy link

Pilleo commented Aug 7, 2017

#841
guess the same issue

@twalpole
Copy link
Author

twalpole commented Aug 7, 2017

@Pilleo Looks like it -- this issue report has the trace level log though.

@Pilleo
Copy link

Pilleo commented Aug 7, 2017

@twalpole sure, I was just glad to see I am not the only one with the issue.

@andreastt
Copy link
Contributor

@Pilleo Using Firefox Nightly, I’m successfully able to set the <input type=file> on http://adiso.us/post-free-ad to a file. A second file upload field even appears.

However, there are problems with the Get Element Property command which for some reason always appears to return an empty string.

This doesn’t explain why you are seeing an invalid argument error.

@twalpole
Copy link
Author

twalpole commented Aug 8, 2017

@andreastt I get the same result with nightly "57.0a1 (2017-08-08) (64-bit)" - Invalid Argument Error: File not found: ...

@andreastt
Copy link
Contributor

Off the top of my head, this could be one of three things:

  1. A translation bug between geckodriver input and Marionette input (geckodriver is a proxy for Marionette)
  2. A platform specific issue on macOS
  3. Simply that the file doesn’t exist because you’re using geckodriver remotely through Selenium Grid

@twalpole
Copy link
Author

twalpole commented Aug 8, 2017

@andreastt 2 and 3 can be ruled out since it occurs on both macOS and linux (I haven't tested windows) and the file definitely exists and is not being run through Selenium Grid. The same code worked with the geckodriver 0.17.0 and FF 54, fails with 0.17.0/0.18.0 and FF 55. The code being run is the Capybara test suite.

@Pilleo
Copy link

Pilleo commented Aug 8, 2017

@andreastt
same result on Windows 10 as smb wrote few hours ago, but you deleted it. I am using linux. So it is linux-MacOS-Windows.
File does exist. It works perfectly with Chrome, it did work with ff 54 and early ff 55 I guess.

@slawomir-brzezinski-at-interxion
Copy link

slawomir-brzezinski-at-interxion commented Aug 9, 2017

On .NET on Windows it fails with an extra IndexOutOfBounds note, e.g.:

File not found: C:\blah\blah.zip (IndexOutOfBounds)
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebElement.SendKeys(String text)
...

(and the actual exception is System.InvalidOperationException)

@jimevans
Copy link

At least now it's behaving consistently with the behavior described in #644.

@rdharrison2
Copy link

I'm also now seeing this every time with FF 55.0 on Windows 7 and Windows 10. If I downgrade Firefox to 54.0.1 I don't get the "File not found" webdriver exception.

I'm running with:

  • selenium server 3.4.0
  • geckodriver 0.18.0
  • Firefox 55.0 (32-bit)

I'll see if I can reduce the reproduction as right now it's very complicated, and get some trace logs.

@valignatev
Copy link

Same for me: Arch linux, FF 55.0, geckodriver 0.18, selenium server 3.4.0. Fails on any file upload

@whimboo
Copy link
Collaborator

whimboo commented Aug 14, 2017

This might be a different issue than #644.

Can anyone please run different versions of Firefox 55.0 beta? It would be good to know when this behavior exactly started to narrow down a possible regression, which seems to exist here maybe even in Firefox.

Releases of Firefox beta you can find here: http://archive.mozilla.org/pub/firefox/releases/

Thanks.

@twalpole
Copy link
Author

twalpole commented Aug 14, 2017

@whimboo From the Capybara Travis test logs - this worked with 55.0b10, started failing on 55.0b11

@whimboo
Copy link
Collaborator

whimboo commented Aug 15, 2017

Ok, this is great info. So lets see what could be the cause here. Changes between those two betas are:

https://hg.mozilla.org/releases/mozilla-beta/pushloghtml?fromchange=e26b1f5d635e&tochange=e5f14b9ae6c4c1e0ff1c430503671289120db203

Sadly I cannot see anything in that list of landed changes which would explain that behavior change. Can anyone else confirm this range? Otherwise I would have to try to repro it myself. Thanks.

@whimboo
Copy link
Collaborator

whimboo commented Aug 15, 2017

Or maybe it's a side-effect of bug 1372428 given that it's not only changing behavior for media plugins as stated.

@valignatev
Copy link

Confirm @twalpole experience - I have same regression 55.0b10 -> 55.0b11

@whimboo
Copy link
Collaborator

whimboo commented Aug 15, 2017

Ok, I can reproduce it now and will investigate. Thanks for all the details and help!

@whimboo
Copy link
Collaborator

whimboo commented Aug 15, 2017

I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1390486 and will let you know once it is fixed.

@whimboo
Copy link
Collaborator

whimboo commented Aug 15, 2017

Ok, so geckodriver misses to set the preference "dom.file.createInChild" to true. If you set this pref inside of firefoxOptions you can workaround this problem for now until it is fixed in 57.0 and most likely the next 56.0 beta.

@twalpole
Copy link
Author

twalpole commented Aug 15, 2017

@whimboo Could this be fixed in a geckodriver release rather than having to wait for the next FF alpha/beta? Having to continuously tell people they can't actually test their apps with release versions of FF isn't great.

@whimboo
Copy link
Collaborator

whimboo commented Aug 15, 2017

Well, just use firefoxOptions and add the preference "dom.file.createInChild" set to true. It's the workaround for now which even works with geckodriver 0.18.

@twalpole
Copy link
Author

twalpole commented Aug 15, 2017

@whimboo Yes, but that's one more thing to document for users that could (should?) just be automatically handled by a geckodriver minor release.

@whimboo
Copy link
Collaborator

whimboo commented Aug 15, 2017

We will release a new version when it's ready. So far this problem is not that wide-spread and we have a workaround.

@valignatev
Copy link

@twalpole you can make a PR :)
@whimboo Thanks for workaround, you rock!

@twalpole
Copy link
Author

@valentjedi I don't work with Rust, and the source has recently moved off GitHub into Mozilla central, making PRs a bit more difficult to submit.

@whimboo
Copy link
Collaborator

whimboo commented Aug 15, 2017 via email

@joshroe
Copy link

joshroe commented Aug 17, 2017

Just in case anyone else is looking for a workaround in phpunit-selenium:
private $firefoxProfile = 'UEsDBAoAAAAAAN2KEEsAWqyGKwAAACsAAAAIABwAcHJlZnMuanNVVAkAA+LhlFni4ZRZdXgLAAEEG/X2BwSDj6gMdXNlcl9wcmVmKCJkb20uZmlsZS5jcmVhdGVJbkNoaWxkIiwgdHJ1ZSk7ClBLAQIeAwoAAAAAAN2KEEsAWqyGKwAAACsAAAAIABgAAAAAAAEAAACkgQAAAABwcmVmcy5qc1VUBQAD4uGUWXV4CwABBBv19gcEg4+oDFBLBQYAAAAAAQABAE4AAABtAAAAAAA=';
and add this to setup:
$this->setDesiredCapabilities(['firefox_profile' => $this->firefoxProfile]);

@andreastt
Copy link
Contributor

@bc-joshroe It would be better to send the preference as a capability:

{"moz:firefoxOptions": {
  "prefs": [
    {"dom.file.createInChild": true}
  ]
}

@whimboo
Copy link
Collaborator

whimboo commented Aug 17, 2017

The patch landed for beta and will be part of the next 56.0b4 release.

@mozilla mozilla deleted a comment from 91pr1nc3 Aug 23, 2017
@DustinPham
Copy link

DustinPham commented Aug 29, 2017

This is still an issue with geckodriver 0.18 and Firefox 55.0.2, but the "dom.file.createInChild" fix still works.

@whimboo
Copy link
Collaborator

whimboo commented Aug 30, 2017

Please read #858 (comment) how to workaround that.

I'm going to lock the conversation now given that we don't need more me too replies for a fixed issue but not released fix.

@mozilla mozilla locked and limited conversation to collaborators Aug 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants