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

164
Visualizações
WebdriverIO - OR logical operator in selector

I am using Webdriver IO in my project. I have the following code:

<div>
   <section id="my-section">
      {oneVariable && <p>enumVal1</p>}
      {someVariable && <p>enumVal2</p>}
      {anotherVariable && <a href="someSite">{anotherVariable}</a>}
   </section>
</div>

Is there an easy way through WebdriverIO, to check whether either of the enums (enumVal1 or enumVal2) exist?

I've tried the following but this doesn't work:

$('#my-section').$('p*=enumVal1, p*=enumVal2').isExisting()

Problem is this selector is not treating these values with the OR operator. Is there an easy way to do this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Seems like webdriverIOs element locators don't allow the partial link text selector (*=) with the css OR condition (,). You could achieve this using xpath but it is a little messier.

$('#my-section').$(//p[text()="enumVal1"] | p[text()="enumVal2"]);
 
about 4 years ago · Juan Pablo Isaza 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