Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!