minkphp / MinkSelenium2Driver

Selenium2 (webdriver) driver for Mink framework
MIT License
507 stars 163 forks source link

Unable to upload a file with both Firefox and Chrome #282

Closed Drillan767 closed 6 years ago

Drillan767 commented 6 years ago

For the context, I have to fill a form that has a file upload. When a file is attached to the field, a new text field shows up to allow the user to add an alternate text.

My issue is that for some reasons, MinkSelenium2Driver can't find the file while Behat can.

I launch the server with the following command:

 java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.10.0.jar

Here is the scenario:

 @javascript
  Scenario: Modification d'un produit
        Given I am on the homepage
        And I am logged in with "administrator spheria"
        When I go to "/node/add/svie_produit"
        And I attach the file "project/features/files/progression.png" to "files[field_produit_image_0]"
        And I fill in "progression" for "field_produit_image[0][alt]"
        And I press "Enregistrer"
        Then the url should match "/node/[0-9]+$"

When running the test, I get the following error:

 And I attach the file "spheria/features/files/progression.png" to "files[field_produit_image_0]"
      invalid argument: File not found : project/features/files/progression.png
        (Session info: chrome=64.0.3282.186)
        (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.3.9600 x86_64) (Exception)

Of course, the file exists, and what bothers me is that the test doesn't fait when I use GoutteDriver (until the next line where it can't find the ajax generated field)

What can I do to solve this?

Thank you in advance

Drillan767 commented 6 years ago

Update : I should have tested it myself, it needed the file's full path, sorry for the inconvenience

jonnadams commented 6 years ago

@Drillan767, I seem to be having the same issue that you mentioned. I've tried using the full file path like you mentioned but still seem to be getting issues. Would you be able to show me a sample of what you did to be able to get it working? Thanks in advance!