Get By Attribute That Starts With String X

<ol id="pickup">
    <label data-label="missed">Yesterday</label>
    <label data-label="Today 10am-11am">Today 10am-11am</label>
    <label data-label="Today 2pm-3pm">Today 2pm-3pm</label>
    <label data-label="Tomorrow 10am-11am"
      >Tomorrow 10am-11am</label
// get all labels with "data-label" that start with "Today"
// or start with "Tomorrow"

Let's say we need to get the first available time slot, which can be only the ones that are today or tomorrow.


Alternatively, we notice that the labels have the text we can use, thus cy.contains command with a regular expression works here.

cy.contains('label', /^Today|Tomorrow/).should('be.visible')