You can use XPath Selectors with Symfony's DomCrawler.
To select your desired element use this XPath expression:
Then place it inside a PHPUnit assertion.
$this->assertEquals(1, $crawler->filterXPath('//td//small/span[@class="glyphicon glyphicon-pushpin"]')->count() );
I've used assertEquals 1 as expected value, to ensure that one element is found on the page.
Actually, the question can be treated as a string match problem. There are several different ways to do that.
$ret = $html->find('td[class=*glyph]');
- use regular expression in PHP
the pattern string may like
- run grep command in the shell
$ grep glyph xxx.php
- Checking for a table row using DomCrawler
- Doctrine - using the same table for multiple (many-to-many) relations
- How can I color a row in table I generated using stwe / DatatablesBundle?
- Using Symfony DomCrawler to get Table Rows
- Get row number for each record retrieved from MySQL using Twig in Symfony
- How can I skip or remove a list of html tags from my crawler object using Symfony DomCrawler Component and Goutte for Laravel 4?
- Choosing a value for a choice using DomCrawler in Symfony2
- How to populate a table based on selection of a row in another table using ng-repeat?
- Display a table using for twig
- Doctrine - using ManyToMany with additional fields and want to save more than one row in association table
- Unable to create table in MySQL using Doctrine and Symfony2
- How can I set the url for the form to POST using the FormBuilder in Symfony2?
- No result was found for query although at least one row was expected
- Running a background task using Symfony Process without having to wait for the process to finish
- Best practice for on/off line data synchronization using AngularJS and Symfony 2
- symfony2 use multiple url pattern for a single Controller Action using regular expression
- Using Symfony 2 CLI tools, how can I generate getters and setters with correct type hinting for sub-classes?
- Why does twig template throw unknown "dump" function when using if statement for 'dev' environment?
- How to ask for additional GET parameters in an endpoint of api-platform using swagger docs?
- Symfony 2 - fetch the last inserted row from table
- How to set a login form for admins and another for other users using FOSUserBundle?
- Using MD5 in symfony2 security.yml for legacy users
- Doctrine2 dynamic table name for entity
- Hot to set PostgreSQL schema for table in Doctrine mapping?
- Change charset and engine for Doctrine2's ManyToMany relationship's intermediary table
- How to stop doctrine trying to create a table for a view that has been mapped on an entity?
- Unable to install bundle for Symfony 3 using Composer
- Runtime exception when trying to dump assetic for Symfony2 project using Windows 7
- Doctrine 2 - Access level problems when using Class Table Inheritance
More Query from same tag
- Symfony 2 Doctrine DQL join query builder
- Understanding Assetic bundle
- symfony2 form with self-referencing multiple checkboxes aren't presented checked in twig
- API platform relations method GET
- Running a symfony2 app using nginx and phpbb3 forum alongside each other
- Doctrine QueryBuilder Re-Use Parts
- How to upload RAR, CSV, DOC, DOCX, XLS and XLSX files to a Symfony2 application
- API Platform GraphQL security
- Symfony manually validate entity with relation
- Symfony3 file uploader
- Symfony3 apply class to each div of generated form
- Symfony Doctrine DQL cannot find createQuery in entity manager
- Consumer Error Handling in Symfony Messenger / RabbitMQ
- No error and no user in session after login form is validated in Symfony 4
- How to map OneToOne relationship with YAML
- Heroku [RuntimeException]An error occurred when executing the "'cache:clear --no-warmup'"
- Passing parent entity Id into child form
- Undefined index: joinColumns doctrine + symfony2
- Twig multiple variables and json_encode
- Sending email using office365 server with swiftmailer in symfony
- Is it good to use magic find methods from Doctrine EntityRepository?
- Doctrine Query doesn't work as expected
- Entities related by many to many not persisted
- Docker / PHP / Apache - File permissions lost when created inside container
- An error occurred when executing the ""cache:clear --no-warmup"" command
- Storing objects in an array and retrieving using PHP
- isValid() method return false in symfony
- Api Platform - Symfony - return json in a persist fuction
- JMSSerializerBundle mixing auto detection and explicit directories?
- Sonata Admin Bundle and roles may explain to me how it works