#229 awaiting-patch
Nicklas Ramhöj

attach_file not defined in Selenium mode

Reported by Nicklas Ramhöj | April 24th, 2009 @ 05:01 AM

Then I attach the file at "/path/to/file.jpg" to "Picture:"

with the step: When /^I attach the file at "([^"])" to "([^"])"$/ do |path, field| attach_file(field, path) end

Generates: undefined method attach_file' for #<Webrat::SeleniumSession:0x2f98b50> (NoMethodError)

  (eval):2:in `attach_file'
  ./features/step_definitions/webrat_steps.rb:90:in `/^I attach the file at "([^\"]*)" to "([^\"]*)"$/'
  features/create_content_boxes.feature:21:in `When try to add a "picture" box'

Comments and changes to this ticket

  • gaffo

    gaffo May 10th, 2009 @ 09:36 PM

    • Tag changed from attach_file, selenium to attach_file, selenium, verify
    • State changed from “new” to “open”
  • ian (at ianduggan)

    ian (at ianduggan) May 26th, 2009 @ 09:33 PM

    I created a patch for this. It only works with "*chrome" as the browser. There are other tricks for turning down the firefox permissions, but just using chrome is probably easiest.

    https://webrat.lighthouseapp.com/projects/10503/tickets/251-patch-i...

  • gaffo

    gaffo May 27th, 2009 @ 12:25 PM

    Ian added this commit. It works for chrome as he says.
    http://github.com/ijcd/webrat/commit/d79a2920fb17b59e88673d5245c2fc...

    Would definitely like to see some specs and integration tests for this.

    Also this only works with chrome so I have no easy way to verify it (linux only).

  • ian (at ianduggan)

    ian (at ianduggan) May 27th, 2009 @ 12:46 PM

    Sorry, I should have been clearer about the browser it works with. It works with firefox when you start using:

    config.selenium_browser_key = "*chrome"

    I have not tested with Google Chrome.

    I will see about adding spec/integration tests, though I'm not sure how to deal w/ warning people on non-supporting browsers. Ideas?

  • gaffo

    gaffo May 27th, 2009 @ 02:03 PM

    • State changed from “open” to “awaiting-patch”

    warnings should look like however the deprecation is outputting.

    So to use firefox you do
    config.selenium_browser_key = "*chrome"

    That seems a bit odd.

  • ian (at ianduggan)

    ian (at ianduggan) May 28th, 2009 @ 08:10 PM

    Yeah, the "*chrome" stuff causes selenium to use a firefox with reduce permission restrictions. I think it's related to the chrome:// urls or so, I'm not sure. It predated Google Chrome.

  • Rodreegez

    Rodreegez October 14th, 2009 @ 06:25 AM

    I can't seem to get this patch to work. I am running with *chrome, but the only places this works is where the file upload is not validated by the rails app. The step passes, but on submitting the form I get the error message for not uploading a file. Looking at the test log, I see that there is not actually a file path submitted.

    Are we sure this works, or is it just me?

    Thanks,

    Ad.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Referenced by

Pages