Giter VIP home page Giter VIP logo

minkgouttedriver's People

Contributors

aik099 avatar alexpott avatar benja-m-1 avatar clemherreman avatar cweiske avatar davedevelopment avatar eugenegp avatar everzet avatar hason avatar hussainweb avatar rjmunro avatar simonschaufi avatar stephpy avatar stof avatar swestcott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minkgouttedriver's Issues

Add support for Symfony 5.

Dependency behat/mink-browserkit-driver was updated at 13 December 2021 to version 2.0 which support Symfony 5. Please update this dependency in your composer.json

Goutte Driver does not post empty textareas

If I have a form:

<form method="POST">
    <textarea name="textarea"></textarea>
    <input type="submit" name="submit" value="Save" />
</form>

when I submit the form using the Goutte Driver, my POST array, server side, has nothing for the textarea.

array (
  'submit' => 'Save'
)

If I submit the same form using the selenium 2 driver and Firefox, then I see

array (
  'textarea' => '',
  'submit' => 'Save',
)

This also affects multidimensional form elements. Submitting this form:

<form method="POST">
    <div class="section">
        <textarea name="textarea[]" ></textarea>
        <input type="text" name="first[]" />
    </div>
    <div class="section">
        <textarea name="textarea[]" ></textarea>
        <input type="text" name="first[]" />
    </div>
    <input type="submit" name="submit" value="Save" />
 </form>

Leaves me with

array (
  'first' => 
  array (
    0 => '',
    1 => '',
  ),
  'submit' => 'Save',
)

When I would expect (and get with Firefox)

array (
  'textarea' =>
   array(
     0 => '',
     1 => '',
    ),
  'first' => 
  array (
    0 => '',
    1 => '',
  ),
  'submit' => 'Save',
)

Support basic auth parameters in URL

I can use URLs with username and password fine with the selenium2 driver (and Firefox behind that), but goutte does not support it:

$session->visit('https://username:[email protected]');
echo $session->getPage()->getContent();

goutte has "401 Unauthorized" page content, selenium2 has the correct content. It would be nice if basic auth parameters would be extracted from the URL.

setRequestHeader doesn't set header on the Goutte client instance

I was expecting that, in a Mink context, calling

$this->getSession()->getDriver()->getClient()->setRequestHeader('Accept-Language', 'en');

had the same outcome as

$this->getSession()->setRequestHeader('Accept-Language', 'en');

But actually it doesn't, and the call gets "ignored". This is because the Goutte driver uses the same implementation of BrowserKit, which of course has no knowledge of the Guzzle HTTP client, so it doesn't provide it with the header. I'd like to know if this a real issue or I misundertood something. In the former case, I'll do a pull request.

Js evaluate error

Code what I am used:

<?php
require_once "vendor/autoload.php";
use Behat\Mink\Mink,
    Behat\Mink\Session,
    Behat\Mink\Driver\GoutteDriver,
    Behat\Mink\Driver\Goutte\Client;
$driver = new \Behat\Mink\Driver\GoutteDriver();
$session = new \Behat\Mink\Session($driver);
// start the session
$session->start();
//Visiting link
 $session->visit("http://3.134.82.150/d_a.php");
$session->wait(
    5000,
    "document.documentElement.innerHTML"
);
// use history controls:
//$session->back();
//$session->forward();

Error what I got:

Fatal error: Uncaught Behat\Mink\Exception\UnsupportedDriverActionException: JS is not supported by Behat\Mink\Driver\GoutteDriver in C:\laragon\www\js\vendor\behat\mink\src\Driver\CoreDriver.php:449 Stack trace: #0 C:\laragon\www\js\vendor\behat\mink\src\Session.php(354): Behat\Mink\Driver\CoreDriver->wait(5000, 'document.docume...') minkphp/Mink#1 C:\laragon\www\js\index.php(21): Behat\Mink\Session->wait(5000, 'document.docume...') minkphp/Mink#2 {main} thrown in C:\laragon\www\js\vendor\behat\mink\src\Driver\CoreDriver.php on line 449

Redirects do not work with Goutte v1.0.3 when base url is not on 80 port

Hi

Recently Goutte upgraded to v1.0.3 and after that redirecting doesn't work properly for some reason:
2013-08-27 0 39 56

I use 8080 port, but it's trying to open same domain on 80 port. When I downgrade goutte to v1.0.2 it works correct. Please advise. Maybe it's worth to put version restrictions in composer.json?

"no matching package found" message with Composer install

Hello,

Install process with composer was ok until recent changes ... probably changes on composer.json file ? Behat@5d8b3eb#composer.json

Now with a "clean install" (means no source in vendor folder for Symfony 1.4 project), composer returns an error message :

$ php composer.phar install
Installing dependencies
Your requirements could not be solved to an installable set of packages.

  Problem 1
    - behat/mink-goutte-driver v1.0.3 requires fabpot/goutte @dev -> no matching package found.
    - behat/mink-goutte-driver v1.0.2 requires fabpot/goutte 1.0.*@dev -> no matching package found.
    - behat/mink-goutte-driver v1.0.1 requires fabpot/goutte 1.0.x-dev -> no matching package found.
    - behat/mink-goutte-driver v1.0.0 requires fabpot/goutte 1.0.* -> no matching package found.
    - Installation request for behat/mink-goutte-driver * -> satisfiable by behat/mink-goutte-driver v1.0.0, behat/mink-goutte-driver v1.0.1, behat/mink-goutte-driver v1.0.2, behat/mink-goutte-driver v1.0.3.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.

I use Mink Goutte extension with Behat so here is my composer.json :

{
    "require": {
        "behat/behat": ">=2.4@stable",
        "behat/mink":  "1.4@stable",
        "behat/mink-extension": "*",
        "behat/mink-goutte-driver": "*"
    },

    "config": {
        "bin-dir": "bin/"
    }
}

Thanks,

Jonathan

verify: false in Guzzle parameters no longer works with Goutte 3

With the addition of Goutte 3 support in version 1.2.0, my scenarios are now throwing SSL errors even though I have the recommended settings from the Mink Extension documentation:

default:
    extensions:
        Behat\MinkExtension:
            sessions:
                my_session:
                    goutte:
                        guzzle_parameters:
                            verify: false

If I downgrade to version 1.1.0 (and therefore to Goutte 2 & Guzzle 5), my scenarios work again and the SSL cert is ignored as expected. I'm not exactly sure if the problem is in the driver, or something in Goutte or Guzzle but my problem was definitely triggered by the driver's update to 1.2.0.

Submitting a form with empty action and base href

I'm using ~1.0 of this driver and I try to submit a form with an empty action. The form should be posted to its own file, but for some reason the href value of the <base> element is taken instead. This means all my tests fail :(

To replicate this issue:

http://localhost/some/form.phtml

<!doctype html>

<base href="http://localhost/">

<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  echo 'Whoa!';
}
?>

<form action="#" method="POST">
  <input type="submit" value="submit">
</form>

formtest.php

<?php

require 'vendor/autoload.php';

use Behat\Mink\Mink,
    Behat\Mink\Session,
    Behat\Mink\Driver\GoutteDriver,
    Behat\Mink\Driver\Goutte\Client as GoutteClient;

$mink = new Mink(array(
    'goutte' => new Session(new GoutteDriver(new GoutteClient())),
));

$session = $mink->getSession('goutte');
$session->visit('http://localhost/some/form.phtml');
$btn = $session->getPage()->findButton('submit');
$btn->click();

echo $session->getCurrentUrl(); // returns 'http://localhost#' should be 'http://localhost/some/form.phtml#'

Goutte Driver cannot be downloaded from Composer

While trying to install browser drivers for Mink with Composer, I get the following reply:

 [Composer\Downloader\TransportException]                                                                                                             
  The "https://api.github.com/repos/Behat/MinkGoutteDriver/zipball/v1.0.6" file could not be downloaded: failed to open stream: HTTP request failed!   

The file is no longer available and redirects to:

https://codeload.github.com/Behat/MinkGoutteDriver/legacy.zip/v1.0.6 with response code 324.

Is an update of the repos/versions required for new install?

Same goes for Selenium.

Form Submitting when there are submit buttons with same name attribute

Following up Behat/Mink#212 and opening issue in new Goutte repo.

Is it possible that GoutteDriver can work with input submit elements with same name?

We are evaluating mink testing with Drupal application and problem is that Drupal is always creating form submit buttons with the same name attribute. Typical example

<input id="edit-submit" class="form-submit" type="submit" value="Save" name="op">
<input id="edit-delete" class="form-submit" type="submit" value="Delete" name="op">

And Drupal form api is expecting this situation so I can not change name attributes here to be unique - which means that currently Drupal can not be tested with GoutteDriver.

Can this be fixed?

GoutteDriver can't find any elements

Hi, I a have a very strange behavior that I can't quite understand. Goutte (1.0.9) seems to be unable to find any elements on a page. I tried with the Selenium Driver, just to make sure it was not related to my markup:

  @javascript
  Scenario: Navigating to the webapp page                                 # features/01-navigating.feature:61
    Given I am on the homepage                                            # FeatureContext::iAmOnHomepage()
    When I follow "Web Applications"                                      # FeatureContext::clickLink()
    And the "li.subpage.active" element should contain "Web Applications" # FeatureContext::assertElementContains()

  Scenario: Navigating to the webapp page                                  # features/01-navigating.feature:66
    Given I am on the homepage                                             # FeatureContext::iAmOnHomepage()
    When I follow "Web Applications"                                       # FeatureContext::clickLink()
    Then the "li.subpage.active" element should contain "Web Applications" # FeatureContext::assertElementContains()
      Element matching css "li.subpage.active" not found.

      +--[ HTTP/1.1 200 | http://1024.local/services/web-application-development | GoutteDriver ]
      |
      |  <body>
      |  
      |          <!-- Header -->
      |          <header>
      |              <div class="container">
      |                  <div class="header row">
      |                      <div class="logo span4">
      |                          <h2><a href="/"><strong>Logo</strong><span class="light">.domain</span></a></h2>
      |                      </div>
      |                      <div class="span8">
      |                          <nav id="primary">
      |                              <ul class="nav nav-list pull-right">
      |                                                                  <li class="section-1">
      |                                      <a href="#ubiquitous">
      |                                                                                  <i class="icon-globe"></i>
      |                                                                          Ubiquitous</a>
      |                                  </li>
      |                                                                  <li class="section-2">
      |                                      <a href="#useability">
      |                            ...
      |
    And the response status code should be 200                             # FeatureContext::assertResponseStatus()

2 scenarios (1 passed, 1 failed)
7 steps (5 passed, 1 skipped, 1 failed)
0m3.604s

One can see that Selenium finds the element just fine, but goutte doesn't. I've tried with other elements (div.container for example) but that doesn't work either. Goutte then says it doesn't find the element, even though it's even listed in the debug output.

Any help greatly appreciated.

Custom port configuration issue

I'm desperatly trying to have behat to run headless tests using mink and goutte on top of the PHP built-in webserver runnin on a custom port but I'm probably missing or overlooking something.

Following is the configuration I'm currently using:
https://gist.github.com/debo/2ed20f22685b816bfb9d

I also tried to add the port to the base_url but it doesn't work either. A quick initial investigation suggests that the problem is here:

https://github.com/symfony/browser-kit/blob/master/Client.php#L534

No matter what the port seems to get stripped off. Any idea about how to make this work properly?

set "redirect.disable" guzzle parameter

in FriendsOfPHP/Goutte#85, they changed the way they create the guzzle client, passing the redirect.disable = true parameter since redirects are handled by BrowserKit, not guzzle.

$this->client = new GuzzleClient('', array('redirect.disable' => true));

Since the goutte driver creates a guzzle service in the dependency injection container, these defaults should be matched by the driver. I was able to get this working by adding the param in my behat.yml file, but ran into trouble adding it to the goutte.xml (part of Behat/MinkExtension) because the Symfony tree builder complained about having a variable with a period in the name.

Here's what I did in my behat.yml:

default:
  extensions:
    Behat\MinkExtension\Extension:
      goutte: 
        guzzle_parameters:
          redirect.disable: true

BTW, the issue I had that led to me finding this was that an HTTP response with set-cookie headers as well as a location header would process the redirect without handling the new cookies. This is because the redirect was being handled by guzzle, instead of BrowserKit as Goutte expects.

Goutte Driver does not seem to follow redirections anymore... ?

Hi,

I have the following step declaration :

<?php

class FeatureContext extends MinkContext
{
    /**
     * Connects the user
     *
     * @When /^I am connecting with "(?P<user>(?:[^"]|\\")*)" and "(?P<pass>(?:[^"]|\\")*)"$/
     *
     * @param string $user username to log in
     * @param string $pass username's password
     */
    public function iAmConnectingWithAnd($user, $pass)
    {
        $this->fillField('username', $user);
        $this->fillField('password', $pass);
        $this->pressButton('Login');
    }
}

Until some days ago, it was working perfectly fine. But now, as it seems goutte have upgraded its dependencies to guzzle 3.0+, it does not seem to follow any redirections... In the above example, if i'm doing a simple When I am connecting with "user" and "pass", the step succeeds (it finds the fields, ... etc), but, on a Symfony project, i'm stuck on the /login_check page, and it does nothing, and does not authenticate the user properly.

The thing is, login_check is not even identified as a redirection ; and my user stays unlogged... I also tried to go to another url ($this->visit('/');), but my user is still not identified.

I'm not sure this is the right place to report this issue ?

Checkbox "foo" is not checked, but it should be.

The following doesn't work with goutte but with selenium driver

Feature: checkbox

  Scenario: create a new customer
    Given I am on "http://127.0.0.1:8080/form.html"

    And the "fuuu" checkbox should be checked # id works
    And the "foo" checkbox should be checked # name works
    And the "Label" checkbox should be checked # label works
    And the "bar" checkbox should be checked # value failed

see also #56

composer.json

{
    "require": {
        "behat/behat": "3.1.*",
        "behat/mink": "1.7.1",
        "behat/mink-extension": "2.2",
        "behat/mink-goutte-driver": "1.2.1"
    },
    "config": {
        "bin-dir": "bin/"
    }
}

html

<html>
<head>
</head>
<body>
<form action="#">

    <label for="fuuu">Label</label>
    <input type="checkbox" id="fuuu" name="foo" value="bar" checked>

    <input type="submit" value="send">

</form>
</body>
</html>

behat.yml

default:
    extensions:
        Behat\MinkExtension: 
            base_url: 'http://127.0.0.1'
            show_cmd: 'firefox %s'
            default_session: http
            javascript_session: javascript
            sessions:
                http:
                    goutte:
                        guzzle_parameters:
                            verify: false
                javascript:
                    selenium2:
                        wd_host: "http://localhost:8643/wd/hub"
        Sanpi\Behatch\Extension: ~

    suites:
        default:
            contexts:
                - FeatureContext
                - Behat\MinkExtension\Context\MinkContext
                - behatch:browser

run with php -S 127.0.0.1:8080

Checkbox "foo" is not checked, but it should be.

I'm trying to test whether the foo checkbox is checked:

<form>
    <input type="checkbox" name="foo" id="foo" value="on" checked="checked">
    <input type="submit" />
</form>
Given I am on "/"
Then the "foo" checkbox should be checked

And I'm getting:

Checkbox "foo" is not checked, but it should be.

Is Behat/Behat#298 fixed?

Not find input checkbox when name is an empty array

I'm not sure if here is the place, the issue is that if I have a html like this:

<label for="form_foo_var">Foo</label>
<input type="checkbox" id="form_foo_var" name="form[foo][]" value="var" />

And in a scenario I have this step:

And I check "form_foo_var"

I get "Call to a member function tick() on a non-object in /home/fran/dev/project/vendor/behat/mink-browserkit-driver/src/Behat/Mink/Driver/BrowserKitDriver.php on line 448"

This happens when the name is an empty array

New tag due?

It seems there was 10 months and many commits since 1.0.9 was created. I am getting issues in some checkouts due to other changes in mink or whatever so different versions of fabpot/goutte are required - but it only happens if it is NOT a clean reinstall. Perhaps a new tag should be made?

Hidden fields disregarded normal?

Is it normal behavior for hidden fields to be disregarded when using Goutte? I normally have checkboxes paired with hidden fields that use the same name to act as a default value for unchecked form elements but this doesn't work well with mink + goutte. Calling uncheck() on a checkbox field works fine but the hidden element with the same name as the unchecked element doesn't get carried over as a POST value upon submission.

Test suite failing (with tests merged in 27-Apr-2014)

I've tried to run test suite with all the latests tests and it failed:

PHPUnit 4.0.17 by Sebastian Bergmann.

Configuration read from .../phpunit.xml

...............................................FS........F.FFFPHP Fatal error:  Call to a member function hasAttribute() on a non-object in .../vendor/behat/mink-browserkit-driver/src/Behat/Mink/Driver/BrowserKitDriver.php on line 437

Same test passed for MinkBrowserKitDriver, which is strange.

The "Form\GeneralTest::testAdvancedForm" fails on PHP 5.3

I don't know why but the Form\GeneralTest::testAdvancedForm always fails on PHP 5.3 (see https://travis-ci.org/Behat/MinkGoutteDriver/jobs/35642010).

There was 1 failure:

1) Behat\Mink\Tests\Driver\Form\GeneralTest::testAdvancedForm
Failed asserting that '<!DOCTYPE html>
<html>
<head>
    <title>Advanced form save</title>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<body>
array (
  'agreement' = 'on',
  'email' = '[email protected]',
  'first_name' = 'Foo "item"',
  'last_name' = 'Bar',
  'notes' = 'new notes',
  'select_number' = '30',
  'sex' = 'm',
  'submit' = 'Register',
)
03659efe469a88dae2a03960fab7c5f4b8cea9d0.txt
1 uploaded file
</body>
</html>' contains "array (
  'agreement' = 'on',
  'email' = '[email protected]',
  'first_name' = 'Foo "item"',
  'last_name' = 'Bar',
  'notes' = 'new notes',
  'select_number' = '30',
  'sex' = 'm',
  'submit' = 'Register',
)
some_file.txt
1 uploaded file".

/home/travis/build/Behat/MinkGoutteDriver/vendor/behat/mink/driver-testsuite/tests/Form/GeneralTest.php:220

From the looks of it the uploaded filename isn't printed out from fixture file after form is being submitted. The actual printing is done by fixture file on Mink, which is released: https://github.com/Behat/Mink/blob/master/driver-testsuite/web-fixtures/advanced_form_post.php#L19

Fact that it passes on all other PHP versions only proves that, but I wonder what's so special about PHP 5.3 that makes it stop working.

Allow to set user agent for goutte driver in behat

After digging in the code, i found no easy solution to set the user agent of the behat browser.
With selenium tests i can simply use a real browser, but sadly some applications block unknown browsers ... so please add an option for that ;)

How can i set guzzle options?

I want set guzzle configuration parameter in my behat.yml file is there a way?

curl.options CURLOPT_PROXY: 'mhde.gf.myh.dev:8888'

Or how can i override the guzzle client class with my own?

Or how can i access it in my Context to set the option.

No support for different request methods.

Currently I cannot specify the request method that I want to use. For testing REST interfaces this is rather unfortunate :)

Currently all requests are set as 'GET' in BrowserkitDriver:

$this->client->request('GET', $this->prepareUrl($url));

Please allow for an optional parameter to specify the request method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.