---
url: 'https://metadrop.net/es/articulos/convertir-expresiones-css-xpath'
title: 'Convertir expresiones CSS en XPath'
author: 'Ricardo Sanz'
date: '2017-01-17T10:46:58+00:00'
updated: '2026-02-18T09:46:39+00:00'
type: article
summary: 'Al escribir pasos en Behat podemos necesitar indicar un elemento del DOM sobre el que actuar.'
tags:
  - CSS
  - XPath
  - Behat
  - 'Mink Extension'
published: true
og:
  determiner: Automatic
  site_name: Metadrop
  'image:alt': 'Convertir expresiones CSS en XPath'
  street_address: 'Calle Manuel Luna, 12, 3 Dcha'
  locality: Madrid
  region: Madrid
  postal_code: '28020'
  country_name: España
  email: hola@metadrop.net
  phone_number: '910053180'
schema:
  '@context': 'https://schema.org'
  '@graph':
    -
      '@type': Article
      '@id': 'https://metadrop.net/es/articulos/convertir-expresiones-css-xpath#article'
      name: 'Convertir expresiones CSS en XPath'
      headline: 'Convertir expresiones CSS en XPath'
      description: 'Al escribir pasos en Behat podemos necesitar indicar un elemento del DOM sobre el que actuar.'
      about:
        - CSS
        - XPath
        - Behat
        - 'Mink Extension'
      datePublished: '2013-09-24T09:00:00+0200'
      dateModified: '2026-02-18T10:46:39+0100'
      author:
        '@type': Person
        name: 'Ricardo Sanz'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
      mainEntityOfPage: 'https://metadrop.net/es/articulos/convertir-expresiones-css-xpath'
    -
      '@type': Organization
      '@id': 'https://metadrop.net/#organization'
      url: 'https://metadrop.net/'
      name: Metadrop
      sameAs:
        - 'https://www.drupal.org/metadrop'
        - 'https://twitter.com/metadrop'
        - 'https://asociaciondrupal.es/partner/metadrop'
        - 'https://www.linkedin.com/company/metadrop'
      logo:
        '@type': ImageObject
        url: 'https://metadrop.net/themes/custom/mdrop_radix/logo-metadrop-500-500.jpg'
        width: '500'
        height: '500'
    -
      '@type': ItemPage
      '@id': 'https://metadrop.net/es/articulos/convertir-expresiones-css-xpath'
      breadcrumb:
        '@type': BreadcrumbList
        itemListElement:
          -
            '@type': ListItem
            position: 1
            name: Inicio
            item: 'https://metadrop.net/es'
          -
            '@type': ListItem
            position: 2
            name: 'Artículos expertos sobre Drupal y tecnología'
            item: 'https://metadrop.net/es/articulos'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
---
 1. [Artículos](https://metadrop.net/es/articulos)
 
  

# Convertir expresiones CSS en XPath

Martes 24 de Septiembre de 2013

 

 



Al escribir pasos en Behat podemos necesitar indicar un elemento del DOM sobre el que actuar.



   



Por ejemplo para hacer click:

```php
$this->getMink()->getSession()->getDriver()->click();
```

Para indicar el elemento Mink necesita una expresión XPath, bastante farragosas de construir en ciertas ocasiones. Por suerte, existe un conversor de expresiones CSS a XPath:

<https://css2xpath.appspot.com/>

Está escrito por [Ian Bicking](https://blog.ianbicking.org/), desarrollador de Mozilla.



[CSS](https://metadrop.net/es/articulos?text=CSS)

[XPath](https://metadrop.net/es/articulos?text=XPath)

[Behat](https://metadrop.net/es/articulos?text=Behat)

[Mink Extension](https://metadrop.net/es/articulos?text=Mink%20Extension)

 

- Ricardo Sanz
    
    CTO