Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

432
Visualizações
select only and element on a list of xpaths

$x("//div[@class='card-info__container']/div[3]/a") using this I've found the container, but now I can't get the specific element I need.

when I enter this the response is:

⯆(3) [a.cta.btn, a.cta.btn, a.cta.btn]
  ⯈0: a.cta.btn
  ⯈1: a.cta.btn
  ⯈2: a.cta.btn

how can I take only the first one?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You can use the at() method to select the first item from the array of a that is returned from executing the XPath:

$x("//div[@class='card-info__container']/div[3]/a").at(0)
over 4 years ago · Santiago Trujillo Relatório

0

For an XPath that returns a list of elements,

xpath

you can select only the first element via indexing:

(xpath)[1]
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda