3 namespace Drupal\FunctionalTests;
5 use Behat\Mink\Element\NodeElement;
6 use Behat\Mink\Exception\ExpectationException;
7 use Behat\Mink\Selector\Xpath\Escaper;
8 use Drupal\Component\Render\FormattableMarkup;
9 use Drupal\Component\Utility\Xss;
10 use Drupal\KernelTests\AssertLegacyTrait as BaseAssertLegacyTrait;
13 * Provides convenience methods for assertions in browser tests.
15 * @deprecated Scheduled for removal in Drupal 9.0.0. Use the methods on
16 * \Drupal\Tests\WebAssert instead, for example
18 * $this->assertSession()->statusCodeEquals(200);
21 trait AssertLegacyTrait {
23 use BaseAssertLegacyTrait;
26 * Asserts that the element with the given CSS selector is present.
28 * @param string $css_selector
29 * The CSS selector identifying the element to check.
31 * @deprecated Scheduled for removal in Drupal 9.0.0.
32 * Use $this->assertSession()->elementExists() instead.
34 protected function assertElementPresent($css_selector) {
35 $this->assertSession()->elementExists('css', $css_selector);
39 * Asserts that the element with the given CSS selector is not present.
41 * @param string $css_selector
42 * The CSS selector identifying the element to check.
44 * @deprecated Scheduled for removal in Drupal 9.0.0.
45 * Use $this->assertSession()->elementNotExists() instead.
47 protected function assertElementNotPresent($css_selector) {
48 $this->assertSession()->elementNotExists('css', $css_selector);
52 * Passes if the page (with HTML stripped) contains the text.
54 * Note that stripping HTML tags also removes their attributes, such as
55 * the values of text fields.
58 * Plain text to look for.
60 * @deprecated Scheduled for removal in Drupal 9.0.0.
62 * - $this->assertSession()->responseContains() for non-HTML responses,
64 * - $this->assertSession()->pageTextContains() for HTML responses. Unlike
65 * the deprecated assertText(), the passed text should be HTML decoded,
66 * exactly as a human sees it in the browser.
68 protected function assertText($text) {
69 // Cast MarkupInterface to string.
70 $text = (string) $text;
72 $content_type = $this->getSession()->getResponseHeader('Content-type');
73 // In case of a Non-HTML response (example: XML) check the original
75 if (strpos($content_type, 'html') === FALSE) {
76 $this->assertSession()->responseContains($text);
79 $this->assertTextHelper($text, FALSE);
84 * Passes if the page (with HTML stripped) does not contains the text.
86 * Note that stripping HTML tags also removes their attributes, such as
87 * the values of text fields.
90 * Plain text to look for.
92 * @deprecated Scheduled for removal in Drupal 9.0.0.
94 * - $this->assertSession()->responseNotContains() for non-HTML responses,
96 * - $this->assertSession()->pageTextNotContains() for HTML responses.
97 * Unlike the deprecated assertNoText(), the passed text should be HTML
98 * decoded, exactly as a human sees it in the browser.
100 protected function assertNoText($text) {
101 // Cast MarkupInterface to string.
102 $text = (string) $text;
104 $content_type = $this->getSession()->getResponseHeader('Content-type');
105 // In case of a Non-HTML response (example: XML) check the original
107 if (strpos($content_type, 'html') === FALSE) {
108 $this->assertSession()->responseNotContains($text);
111 $this->assertTextHelper($text);
116 * Helper for assertText and assertNoText.
118 * @param string $text
119 * Plain text to look for.
120 * @param bool $not_exists
121 * (optional) TRUE if this text should not exist, FALSE if it should.
125 * TRUE on pass, FALSE on fail.
127 protected function assertTextHelper($text, $not_exists = TRUE) {
128 $args = ['@text' => $text];
129 $message = $not_exists ? new FormattableMarkup('"@text" not found', $args) : new FormattableMarkup('"@text" found', $args);
131 $raw_content = $this->getSession()->getPage()->getContent();
132 // Trying to simulate what the user sees, given that it removes all text
133 // inside the head tags, removes inline Javascript, fix all HTML entities,
134 // removes dangerous protocols and filtering out all HTML tags, as they are
135 // not visible in a normal browser.
136 $raw_content = preg_replace('@<head>(.+?)</head>@si', '', $raw_content);
137 $page_text = Xss::filter($raw_content, []);
139 $actual = $not_exists == (strpos($page_text, (string) $text) === FALSE);
140 $this->assertTrue($actual, $message);
146 * Passes if the text is found ONLY ONCE on the text version of the page.
148 * The text version is the equivalent of what a user would see when viewing
149 * through a web browser. In other words the HTML has been filtered out of
152 * @param string|\Drupal\Component\Render\MarkupInterface $text
153 * Plain text to look for.
154 * @param string $message
155 * (optional) A message to display with the assertion. Do not translate
156 * messages with t(). If left blank, a default message will be displayed.
158 * @deprecated Scheduled for removal in Drupal 9.0.0.
159 * Use $this->getSession()->getPage()->getText() and substr_count() instead.
161 protected function assertUniqueText($text, $message = NULL) {
162 // Cast MarkupInterface objects to string.
163 $text = (string) $text;
165 $message = $message ?: "'$text' found only once on the page";
166 $page_text = $this->getSession()->getPage()->getText();
167 $nr_found = substr_count($page_text, $text);
168 $this->assertSame(1, $nr_found, $message);
172 * Passes if the text is found MORE THAN ONCE on the text version of the page.
174 * The text version is the equivalent of what a user would see when viewing
175 * through a web browser. In other words the HTML has been filtered out of
178 * @param string|\Drupal\Component\Render\MarkupInterface $text
179 * Plain text to look for.
180 * @param string $message
181 * (optional) A message to display with the assertion. Do not translate
182 * messages with t(). If left blank, a default message will be displayed.
184 * @deprecated Scheduled for removal in Drupal 9.0.0.
185 * Use $this->getSession()->getPage()->getText() and substr_count() instead.
187 protected function assertNoUniqueText($text, $message = '') {
188 // Cast MarkupInterface objects to string.
189 $text = (string) $text;
191 $message = $message ?: "'$text' found more than once on the page";
192 $page_text = $this->getSession()->getPage()->getText();
193 $nr_found = substr_count($page_text, $text);
194 $this->assertGreaterThan(1, $nr_found, $message);
198 * Asserts the page responds with the specified response code.
201 * Response code. For example 200 is a successful page request. For a list
202 * of all codes see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
204 * @deprecated Scheduled for removal in Drupal 9.0.0.
205 * Use $this->assertSession()->statusCodeEquals() instead.
207 protected function assertResponse($code) {
208 $this->assertSession()->statusCodeEquals($code);
212 * Asserts that a field exists with the given name and value.
214 * @param string $name
215 * Name of field to assert.
216 * @param string $value
217 * (optional) Value of the field to assert. You may pass in NULL (default)
218 * to skip checking the actual value, while still checking that the field
221 * @deprecated Scheduled for removal in Drupal 9.0.0.
222 * Use $this->assertSession()->fieldExists() or
223 * $this->assertSession()->buttonExists() or
224 * $this->assertSession()->fieldValueEquals() instead.
226 protected function assertFieldByName($name, $value = NULL) {
227 $this->assertFieldByXPath($this->constructFieldXpath('name', $name), $value);
231 * Asserts that a field does not exist with the given name and value.
233 * @param string $name
234 * Name of field to assert.
235 * @param string $value
236 * (optional) Value for the field, to assert that the field's value on the
237 * page does not match it. You may pass in NULL to skip checking the
238 * value, while still checking that the field does not exist. However, the
239 * default value ('') asserts that the field value is not an empty string.
241 * @deprecated Scheduled for removal in Drupal 9.0.0.
242 * Use $this->assertSession()->fieldNotExists() or
243 * $this->assertSession()->buttonNotExists() or
244 * $this->assertSession()->fieldValueNotEquals() instead.
246 protected function assertNoFieldByName($name, $value = '') {
247 $this->assertNoFieldByXPath($this->constructFieldXpath('name', $name), $value);
251 * Asserts that a field exists with the given ID and value.
254 * ID of field to assert.
255 * @param string|\Drupal\Component\Render\MarkupInterface $value
256 * (optional) Value for the field to assert. You may pass in NULL to skip
257 * checking the value, while still checking that the field exists.
258 * However, the default value ('') asserts that the field value is an empty
261 * @throws \Behat\Mink\Exception\ElementNotFoundException
263 * @deprecated Scheduled for removal in Drupal 9.0.0.
264 * Use $this->assertSession()->fieldExists() or
265 * $this->assertSession()->buttonExists() or
266 * $this->assertSession()->fieldValueEquals() instead.
268 protected function assertFieldById($id, $value = '') {
269 $this->assertFieldByXPath($this->constructFieldXpath('id', $id), $value);
273 * Asserts that a field exists with the given name or ID.
275 * @param string $field
276 * Name or ID of field to assert.
278 * @deprecated Scheduled for removal in Drupal 9.0.0.
279 * Use $this->assertSession()->fieldExists() or
280 * $this->assertSession()->buttonExists() instead.
282 protected function assertField($field) {
283 $this->assertFieldByXPath($this->constructFieldXpath('name', $field) . '|' . $this->constructFieldXpath('id', $field));
287 * Asserts that a field does NOT exist with the given name or ID.
289 * @param string $field
290 * Name or ID of field to assert.
292 * @deprecated Scheduled for removal in Drupal 9.0.0.
293 * Use $this->assertSession()->fieldNotExists() or
294 * $this->assertSession()->buttonNotExists() instead.
296 protected function assertNoField($field) {
297 $this->assertNoFieldByXPath($this->constructFieldXpath('name', $field) . '|' . $this->constructFieldXpath('id', $field));
301 * Passes if the raw text IS found on the loaded page, fail otherwise.
303 * Raw text refers to the raw HTML that the page generated.
306 * Raw (HTML) string to look for.
308 * @deprecated Scheduled for removal in Drupal 9.0.0.
309 * Use $this->assertSession()->responseContains() instead.
311 protected function assertRaw($raw) {
312 $this->assertSession()->responseContains($raw);
316 * Passes if the raw text IS not found on the loaded page, fail otherwise.
318 * Raw text refers to the raw HTML that the page generated.
321 * Raw (HTML) string to look for.
323 * @deprecated Scheduled for removal in Drupal 9.0.0.
324 * Use $this->assertSession()->responseNotContains() instead.
326 protected function assertNoRaw($raw) {
327 $this->assertSession()->responseNotContains($raw);
331 * Pass if the page title is the given string.
333 * @param string $expected_title
334 * The string the page title should be.
336 * @deprecated Scheduled for removal in Drupal 9.0.0.
337 * Use $this->assertSession()->titleEquals() instead.
339 protected function assertTitle($expected_title) {
340 // Cast MarkupInterface to string.
341 $expected_title = (string) $expected_title;
342 return $this->assertSession()->titleEquals($expected_title);
346 * Passes if a link with the specified label is found.
348 * An optional link index may be passed.
350 * @param string|\Drupal\Component\Render\MarkupInterface $label
351 * Text between the anchor tags.
353 * Link position counting from zero.
355 * @deprecated Scheduled for removal in Drupal 9.0.0.
356 * Use $this->assertSession()->linkExists() instead.
358 protected function assertLink($label, $index = 0) {
359 return $this->assertSession()->linkExists($label, $index);
363 * Passes if a link with the specified label is not found.
365 * @param string|\Drupal\Component\Render\MarkupInterface $label
366 * Text between the anchor tags.
368 * @deprecated Scheduled for removal in Drupal 9.0.0.
369 * Use $this->assertSession()->linkNotExists() instead.
371 protected function assertNoLink($label) {
372 return $this->assertSession()->linkNotExists($label);
376 * Passes if a link containing a given href (part) is found.
378 * @param string $href
379 * The full or partial value of the 'href' attribute of the anchor tag.
381 * Link position counting from zero.
383 * @deprecated Scheduled for removal in Drupal 9.0.0.
384 * Use $this->assertSession()->linkByHrefExists() instead.
386 protected function assertLinkByHref($href, $index = 0) {
387 $this->assertSession()->linkByHrefExists($href, $index);
391 * Passes if a link containing a given href (part) is not found.
393 * @param string $href
394 * The full or partial value of the 'href' attribute of the anchor tag.
396 * @deprecated Scheduled for removal in Drupal 9.0.0.
397 * Use $this->assertSession()->linkByHrefNotExists() instead.
399 protected function assertNoLinkByHref($href) {
400 $this->assertSession()->linkByHrefNotExists($href);
404 * Asserts that a field does not exist with the given ID and value.
407 * ID of field to assert.
408 * @param string $value
409 * (optional) Value for the field, to assert that the field's value on the
410 * page doesn't match it. You may pass in NULL to skip checking the value,
411 * while still checking that the field doesn't exist. However, the default
412 * value ('') asserts that the field value is not an empty string.
414 * @throws \Behat\Mink\Exception\ExpectationException
416 * @deprecated Scheduled for removal in Drupal 9.0.0.
417 * Use $this->assertSession()->fieldNotExists() or
418 * $this->assertSession()->buttonNotExists() or
419 * $this->assertSession()->fieldValueNotEquals() instead.
421 protected function assertNoFieldById($id, $value = '') {
422 $this->assertNoFieldByXPath($this->constructFieldXpath('id', $id), $value);
426 * Passes if the internal browser's URL matches the given path.
428 * @param \Drupal\Core\Url|string $path
429 * The expected system path or URL.
431 * @deprecated Scheduled for removal in Drupal 9.0.0.
432 * Use $this->assertSession()->addressEquals() instead.
434 protected function assertUrl($path) {
435 $this->assertSession()->addressEquals($path);
439 * Asserts that a select option in the current page exists.
442 * ID of select field to assert.
443 * @param string $option
446 * @deprecated Scheduled for removal in Drupal 9.0.0.
447 * Use $this->assertSession()->optionExists() instead.
449 protected function assertOption($id, $option) {
450 return $this->assertSession()->optionExists($id, $option);
454 * Asserts that a select option with the visible text exists.
457 * The ID of the select field to assert.
458 * @param string $text
459 * The text for the option tag to assert.
461 * @deprecated Scheduled for removal in Drupal 9.0.0.
462 * Use $this->assertSession()->optionExists() instead.
464 protected function assertOptionByText($id, $text) {
465 return $this->assertSession()->optionExists($id, $text);
469 * Asserts that a select option does NOT exist in the current page.
472 * ID of select field to assert.
473 * @param string $option
476 * @deprecated Scheduled for removal in Drupal 9.0.0.
477 * Use $this->assertSession()->optionNotExists() instead.
479 protected function assertNoOption($id, $option) {
480 return $this->assertSession()->optionNotExists($id, $option);
484 * Asserts that a select option in the current page is checked.
487 * ID of select field to assert.
488 * @param string $option
490 * @param string $message
491 * (optional) A message to display with the assertion. Do not translate
492 * messages with t(). If left blank, a default message will be displayed.
494 * @deprecated Scheduled for removal in Drupal 9.0.0.
495 * Use $this->assertSession()->optionExists() instead and check the
496 * "selected" attribute yourself.
498 protected function assertOptionSelected($id, $option, $message = NULL) {
499 $option_field = $this->assertSession()->optionExists($id, $option);
500 $message = $message ?: "Option $option for field $id is selected.";
501 $this->assertTrue($option_field->hasAttribute('selected'), $message);
505 * Asserts that a checkbox field in the current page is checked.
508 * ID of field to assert.
510 * @deprecated Scheduled for removal in Drupal 9.0.0.
511 * Use $this->assertSession()->checkboxChecked() instead.
513 protected function assertFieldChecked($id) {
514 $this->assertSession()->checkboxChecked($id);
518 * Asserts that a checkbox field in the current page is not checked.
521 * ID of field to assert.
523 * @deprecated Scheduled for removal in Drupal 9.0.0.
524 * Use $this->assertSession()->checkboxNotChecked() instead.
526 protected function assertNoFieldChecked($id) {
527 $this->assertSession()->checkboxNotChecked($id);
531 * Asserts that a field exists in the current page by the given XPath.
533 * @param string $xpath
534 * XPath used to find the field.
535 * @param string $value
536 * (optional) Value of the field to assert. You may pass in NULL (default)
537 * to skip checking the actual value, while still checking that the field
539 * @param string $message
540 * (optional) A message to display with the assertion. Do not translate
543 * @deprecated Scheduled for removal in Drupal 9.0.0.
544 * Use $this->xpath() instead and check the values directly in the test.
546 protected function assertFieldByXPath($xpath, $value = NULL, $message = '') {
547 $fields = $this->xpath($xpath);
549 $this->assertFieldsByValue($fields, $value, $message);
553 * Asserts that a field does not exist or its value does not match, by XPath.
555 * @param string $xpath
556 * XPath used to find the field.
557 * @param string $value
558 * (optional) Value of the field, to assert that the field's value on the
559 * page does not match it.
560 * @param string $message
561 * (optional) A message to display with the assertion. Do not translate
564 * @throws \Behat\Mink\Exception\ExpectationException
566 * @deprecated Scheduled for removal in Drupal 9.0.0.
567 * Use $this->xpath() instead and assert that the result is empty.
569 protected function assertNoFieldByXPath($xpath, $value = NULL, $message = '') {
570 $fields = $this->xpath($xpath);
572 if (!empty($fields)) {
576 $this->assertFieldsByValue($fields, $value);
579 catch (\Exception $e) {
583 throw new ExpectationException(sprintf('The field resulting from %s was found with the provided value %s.', $xpath, $value), $this->getSession()->getDriver());
587 throw new ExpectationException(sprintf('The field resulting from %s was found.', $xpath), $this->getSession()->getDriver());
593 * Asserts that a field exists in the current page with a given Xpath result.
595 * @param \Behat\Mink\Element\NodeElement[] $fields
597 * @param string $value
598 * (optional) Value of the field to assert. You may pass in NULL (default) to skip
599 * checking the actual value, while still checking that the field exists.
600 * @param string $message
601 * (optional) A message to display with the assertion. Do not translate
604 * @deprecated Scheduled for removal in Drupal 9.0.0.
605 * Iterate over the fields yourself instead and directly check the values in
608 protected function assertFieldsByValue($fields, $value = NULL, $message = '') {
609 // If value specified then check array for match.
614 foreach ($fields as $field) {
615 if ($field->getAttribute('type') == 'checkbox') {
616 if (is_bool($value)) {
617 $found = $field->isChecked() == $value;
623 elseif ($field->getAttribute('value') == $value) {
624 // Input element with correct value.
627 elseif ($field->find('xpath', '//option[@value = ' . (new Escaper())->escapeLiteral($value) . ' and @selected = "selected"]')) {
628 // Select element with an option.
631 elseif ($field->getTagName() === 'textarea' && $field->getValue() == $value) {
632 // Text area with correct text. Use getValue() here because
633 // getText() would remove any newlines in the value.
636 elseif ($field->getTagName() !== 'input' && $field->getText() == $value) {
642 $this->assertTrue($fields && $found, $message);
646 * Passes if the raw text IS found escaped on the loaded page, fail otherwise.
648 * Raw text refers to the raw HTML that the page generated.
651 * Raw (HTML) string to look for.
653 * @deprecated Scheduled for removal in Drupal 9.0.0.
654 * Use $this->assertSession()->assertEscaped() instead.
656 protected function assertEscaped($raw) {
657 $this->assertSession()->assertEscaped($raw);
661 * Passes if the raw text is not found escaped on the loaded page.
663 * Raw text refers to the raw HTML that the page generated.
666 * Raw (HTML) string to look for.
668 * @deprecated Scheduled for removal in Drupal 9.0.0.
669 * Use $this->assertSession()->assertNoEscaped() instead.
671 protected function assertNoEscaped($raw) {
672 $this->assertSession()->assertNoEscaped($raw);
676 * Triggers a pass if the Perl regex pattern is found in the raw content.
678 * @param string $pattern
679 * Perl regex to look for including the regex delimiters.
681 * @deprecated Scheduled for removal in Drupal 9.0.0.
682 * Use $this->assertSession()->responseMatches() instead.
684 protected function assertPattern($pattern) {
685 $this->assertSession()->responseMatches($pattern);
689 * Triggers a pass if the Perl regex pattern is not found in the raw content.
691 * @param string $pattern
692 * Perl regex to look for including the regex delimiters.
694 * @deprecated Scheduled for removal in Drupal 9.0.0.
695 * Use $this->assertSession()->responseNotMatches() instead.
697 * @see https://www.drupal.org/node/2864262
699 protected function assertNoPattern($pattern) {
700 @trigger_error('assertNoPattern() is deprecated and scheduled for removal in Drupal 9.0.0. Use $this->assertSession()->responseNotMatches($pattern) instead. See https://www.drupal.org/node/2864262.', E_USER_DEPRECATED);
701 $this->assertSession()->responseNotMatches($pattern);
705 * Asserts whether an expected cache tag was present in the last response.
707 * @param string $expected_cache_tag
708 * The expected cache tag.
710 * @deprecated Scheduled for removal in Drupal 9.0.0.
711 * Use $this->assertSession()->responseHeaderContains() instead.
713 protected function assertCacheTag($expected_cache_tag) {
714 $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $expected_cache_tag);
718 * Asserts whether an expected cache tag was absent in the last response.
720 * @param string $cache_tag
721 * The cache tag to check.
723 * @deprecated Scheduled for removal in Drupal 9.0.0.
724 * Use $this->assertSession()->responseHeaderNotContains() instead.
726 * @see https://www.drupal.org/node/2864029
728 protected function assertNoCacheTag($cache_tag) {
729 @trigger_error('assertNoCacheTag() is deprecated and scheduled for removal in Drupal 9.0.0. Use $this->assertSession()->responseHeaderNotContains() instead. See https://www.drupal.org/node/2864029.', E_USER_DEPRECATED);
730 $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', $cache_tag);
734 * Checks that current response header equals value.
736 * @param string $name
737 * Name of header to assert.
738 * @param string $value
739 * Value of the header to assert
741 * @deprecated Scheduled for removal in Drupal 9.0.0.
742 * Use $this->assertSession()->responseHeaderEquals() instead.
744 protected function assertHeader($name, $value) {
745 $this->assertSession()->responseHeaderEquals($name, $value);
749 * Returns WebAssert object.
751 * @param string $name
752 * (optional) Name of the session. Defaults to the active session.
754 * @return \Drupal\Tests\WebAssert
755 * A new web-assert option for asserting the presence of elements with.
757 abstract public function assertSession($name = NULL);
760 * Builds an XPath query.
762 * Builds an XPath query by replacing placeholders in the query by the value
765 * XPath 1.0 (the version supported by libxml2, the underlying XML library
766 * used by PHP) doesn't support any form of quotation. This function
767 * simplifies the building of XPath expression.
769 * @param string $xpath
770 * An XPath query, possibly with placeholders in the form ':name'.
772 * An array of arguments with keys in the form ':name' matching the
773 * placeholders in the query. The values may be either strings or numeric
777 * An XPath query with arguments replaced.
779 * @deprecated Scheduled for removal in Drupal 9.0.0.
780 * Use $this->assertSession()->buildXPathQuery() instead.
782 protected function buildXPathQuery($xpath, array $args = []) {
783 return $this->assertSession()->buildXPathQuery($xpath, $args);
787 * Helper: Constructs an XPath for the given set of attributes and value.
789 * @param string $attribute
791 * @param string $value
795 * XPath for specified values.
797 * @deprecated Scheduled for removal in Drupal 9.0.0.
798 * Use $this->getSession()->getPage()->findField() instead.
800 protected function constructFieldXpath($attribute, $value) {
801 $xpath = '//textarea[@' . $attribute . '=:value]|//input[@' . $attribute . '=:value]|//select[@' . $attribute . '=:value]';
802 return $this->buildXPathQuery($xpath, [':value' => $value]);
806 * Gets the current raw content.
808 * @deprecated Scheduled for removal in Drupal 9.0.0.
809 * Use $this->getSession()->getPage()->getContent() instead.
811 protected function getRawContent() {
812 @trigger_error('AssertLegacyTrait::getRawContent() is scheduled for removal in Drupal 9.0.0. Use $this->getSession()->getPage()->getContent() instead.', E_USER_DEPRECATED);
813 return $this->getSession()->getPage()->getContent();
817 * Get all option elements, including nested options, in a select.
819 * @param \Behat\Mink\Element\NodeElement $element
820 * The element for which to get the options.
822 * @return \Behat\Mink\Element\NodeElement[]
823 * Option elements in select.
825 * @deprecated Scheduled for removal in Drupal 9.0.0.
826 * Use $element->findAll('xpath', 'option') instead.
828 protected function getAllOptions(NodeElement $element) {
829 @trigger_error('AssertLegacyTrait::getAllOptions() is scheduled for removal in Drupal 9.0.0. Use $element->findAll(\'xpath\', \'option\') instead.', E_USER_DEPRECATED);
830 return $element->findAll('xpath', '//option');