WebdriverIO – OR logical operator in selector

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

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

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?


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"]);