@@ -212,9 +212,10 @@ Now you can use CSS selectors with the crawler. To assert that the phrase
212
212
213
213
$this->assertSelectorTextContains('html h1.title', 'Hello World');
214
214
215
- This assertion will internally call ``$crawler->filter('html h1.title') ``, which allows
216
- you to use CSS selectors to filter any HTML element in the page and check for
217
- its existence, attributes, text, etc.
215
+ This assertion checks if the first element matching the CSS selector contains
216
+ the given text. This asserts calls ``$crawler->filter('html h1.title') ``
217
+ internally, which allows you to use CSS selectors to filter any HTML element in
218
+ the page and check for its existence, attributes, text, etc.
218
219
219
220
The ``assertSelectorTextContains `` method is not a native PHPUnit assertion and is
220
221
available thanks to the ``WebTestCase `` class.
@@ -223,15 +224,6 @@ available thanks to the ``WebTestCase`` class.
223
224
224
225
The ``WebTestCase `` assertions were introduced in Symfony 4.3
225
226
226
- .. seealso ::
227
-
228
- Using native PHPUnit methods, the same assertion would look like this::
229
-
230
- $this->assertGreaterThan(
231
- 0,
232
- $crawler->filter('html h1.title:contains("Hello World")')->count()
233
- );
234
-
235
227
The crawler can also be used to interact with the page. Click on a link by first
236
228
selecting it with the crawler using either an XPath expression or a CSS selector,
237
229
then use the client to click on it::
0 commit comments