MinkSelenium2Driver icon indicating copy to clipboard operation
MinkSelenium2Driver copied to clipboard

The "Selenium2Driver::getContent" method is html-decoding it's result

Open aik099 opened this issue 9 years ago • 1 comments

The GeneralTest::testAdvancedForm test started to fail recently:

1) Behat\Mink\Tests\Driver\Form\GeneralTest::testAdvancedForm
Failed asserting that '<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
    <title>Advanced form save</title>
    <meta content="text/html;charset=UTF-8" http-equiv="Content-Type" />
</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',
)
some_file.txt
1 uploaded file
</body></html>' contains "array (
  'agreement' = 'on',
  'email' = '[email protected]',
  'first_name' = 'Foo &quot;item&quot;',
  'last_name' = 'Bar',
  'notes' = 'new notes',
  'select_number' = '30',
  'sex' = 'm',
  'submit' = 'Register',
)
some_file.txt
1 uploaded file".
/home/travis/build/minkphp/MinkSelenium2Driver/vendor/behat/mink/driver-testsuite/tests/Form/GeneralTest.php:220

Here is why:

  1. not long ago as XSS protection we started to html-escape output on .../vendor/behat/mink/driver-testsuite/web-fixtures/advanced_form_post.php page used in above mentioned test
  2. for unknown reasons the source API call of JsonWireProtocol (see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidsource) that we're using for Selenium2Driver::getContent method (see https://github.com/minkphp/MinkSelenium2Driver/blob/master/src/Selenium2Driver.php#L475) started to html-decode (e.g. convert &quot; into ") it's result
  3. now this test fails

I'm not sure how to approach this, because we can't html-encode all page source.

aik099 avatar Sep 16 '16 07:09 aik099

I think this is related to some Firefox API changes. The WebDriver call to get the page source relies on the Browser, which may or may decode HTML entities.

The Docker image selenium/standalone-firefox:2.53.1 used on the test suite was last changed around the same time this issue began to appear. Maybe they changed the Firefox version on that tag.

volkyeth avatar Mar 04 '17 13:03 volkyeth