During one of my tests, I am attempting to choose an option that includes the word "Current."
The dropdown menu appears as follows:
<select name="lead" class="wide">
<option value="">-- Select a lead --</option>
<option value="5066689">Current Lead: L5066689 (kitchens) Created: '27/08/2021 11:10:53'</option>
<option value="5066671"> L5066671 (kitchens) Created: '27/08/2021 09:56:10'</option></select>
I am trying to achieve this using the following function:
const chooseCurrentLeadToSaveAgainst = async () => {
await pageHelpers.waitForSelectorAndClick(selectors.leadDropdown);
await logger.logScreenshot();
await pageHelpers.waitForSelectorAndClick(selectors.currentLead);
};
The leadDropdown selector is:
leadDropdown: 'select.wide',
This method works fine in clicking on the select box, but then I run into issues while trying to click on the option containing the text 'Current' using the currentLead selector:
currentLead: 'option[(contains(text(),\'Current\')]',
Unfortunately, with this selector, the test execution fails to locate and click it. What might be incorrect about this selector?