You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.
When attempting to make a selection using selectByVisibleText() from a drop down menu who's values contain  's, the following error is received:
An element could not be located on the page using the given search parameters.
running chrome
Error: An element could not be located on the page using the given search parameters.
at elementIdElement("4", "./option[normalize-space(.) = "A01 - NORTHWEST"]|./optgroup/option[normalize-space(.) = "A01 - NORTHWEST"]") - selectByVisibleText.js:33:22
This worked for me,
menuItemsOptions(element) - dropdown menu option(s)
dropDownButton(element) - dropdown arrow
textToSelect(String) - text we want to select
static selectByVisibleTextInDropdown(menuItemsOptions, dropDownButton, textToSelect) {
browser.click(dropDownButton);
const menuItems = browser.elements(menuItemsOptions).value;
for (const item of menuItems) {
const menuItem = browser.elementIdText(item.ELEMENT).value;
console.log(`menuItem: ${ menuItem}`);
if (menuItem.toLowerCase().includes(textToSelect.toLowerCase())) {
console.log(`Clicking on ${menuItem}`);
browser.elementIdClick(item.ELEMENT);
break;
}
}
}
From @adamlemisch on December 29, 2016 16:14
The problem
When attempting to make a selection using selectByVisibleText() from a drop down menu who's values contain  's, the following error is received:
Menu structure:
Commands attempted:
PageOnePage.area_drop_down.selectByVisibleText('A01 - NORTHWEST');
PageOnePage.area_drop_down.selectByVisibleText('A01 - NORTHWEST');
Environment
Please let me know if more information is needed.
Copied from original issue: webdriverio/webdriverio#1795
The text was updated successfully, but these errors were encountered: