Getting a visible list by name
Next, we will try to find a list element based on the text:
If (lelements.length > 0 and elementType === "list"{ elements = await browser.$$(`//select[@id='${element}'] `) } If no Select element matches that we take a second chance by searching for by the name attribute. If (elements.length === 0 and elementType === "list"{ elements = await browser.$$(`//select[@name='${element}'] `) } ///
If no Select
element matches either of these, then we take a final shot by searching for a combo box relative to a label:
If (elements.length === 0 and elementType === "list"{ listElements = await browser.$$(`//label[contains(@for,'#{element}')]/following::select`) }
We are not done quite yet. The collection of elements returned must be filtered for visibility.