MinkSelenium2Driver
MinkSelenium2Driver copied to clipboard
The "Selenium2Driver::getContent" method is html-decoding it's result
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 "item"',
'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:
- not long ago as XSS protection we started to html-escape output on
.../vendor/behat/mink/driver-testsuite/web-fixtures/advanced_form_post.phppage used in above mentioned test - for unknown reasons the
sourceAPI call of JsonWireProtocol (see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidsource) that we're using forSelenium2Driver::getContentmethod (see https://github.com/minkphp/MinkSelenium2Driver/blob/master/src/Selenium2Driver.php#L475) started to html-decode (e.g. convert"into") it's result - now this test fails
I'm not sure how to approach this, because we can't html-encode all page source.
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.