Download a file using Behat, Mink & PhantomJS

I am trying to upload a file using Behat. So I wrote this simple HTML page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  </head>
  <body>
    <form method="post" enctype="multipart/form-data">
      <input type="file" name="file" id="file" /><br />
      <input type="submit" />
    </form>
  </body>
</html>

and a simple Behat function:

Feature: test
  Scenario: Some Test
    Given I am on "/upload.php"
    And I attach the file "/path/to/tile" to "file"

When the phrase is executed I attach the file ... to ..., the selenium 2 driver generates a curl request and sends it to PhantomJS:http://localhost:4444/wd/hub/session/5b9a8630-ed8e-11e4-956f-956a9ce75127/element/:wdc:1430215640681/value with params: {"value":["\/path\/to\/file"]}

The request does not end if it is not interrupted, and PhantomJS does not respond to the request.

I was already browsing the net and found several threads saying that it works, and several say that it does not work, including a problem with github ( https://github.com/detro/ghostdriver/issues/282 ) that was closed and reopened several times.

Version: PhantomJS: 2.0.0 Behat: 3.0.15 Mink: 1.6.1 Mink-Selenium2-Driver: 1.2.0

Does anyone know of a working solution to this problem?

+4
1

- , PhantomJS v 2.0.0?

, , Qt 4.8 Qt 5.0, , .

.

, if /src/qt/qtwebkit/Source/WebCore/html/FileInputType.cpp

//if (!ScriptController::processingUserGesture())
//    return;

.

+1

Source: https://habr.com/ru/post/1585092/


All Articles