teampoltergeist/poltergeist

attach_file doesn't attach the file

brandoncc opened this issue · 5 comments

I'm trying to use the code from #342 but I cannot get attach_file to work. It works fine in selenium, but not poltergeist.

pry(#<RSpec::ExampleGroups::SellerManagesProducts::EditsAProduct>)> attach_file("seleniumUpload#{index}", files[index])
=> true

pry(#<RSpec::ExampleGroups::SellerManagesProducts::EditsAProduct>)> evaluate_script('console.log($("#seleniumUpload0").get(0).files.length)')
0

The file does exist and this same code results in 1 being logged in selenium. I am using capybara 2.4.4 and poltergeist 1.6.0 with phantomjs 2.0.0.

I found the phantomjs uploadFile method, which I think is how I need to fix this problem but I can't figure out how to call a phantomjs method through poltergeist.

route commented

File uploading is broken in PhantomJS 2.0 you can downgrade to 1.9 or wait when they fix it

Thank you for your time, I thought it might be an incompatibility between 2.0 and poltergeist but I didn't think it would be 2.0 by itself.

route commented

No problem =) it's known issue ariya/phantomjs#12506

FYI -- this should be fixed via PR #686 - now merged into master

Thank you @twalpole !