.selenide-core.7.7.0.source-code.select-options-by-partial-text.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenide-core Show documentation
Show all versions of selenide-core Show documentation
Selenide = concise API for Selenium WebDriver
The newest version!
(function (select, texts) {
import 'selects.js'
function optionByText(requestedText) {
return Array.from(select.options).find(option => option.text.includes(requestedText))
}
function checkMissingOptionsTexts() {
const missingOptionsTexts = texts.filter(text => !optionByText(text));
return missingOptionsTexts.length > 0 ? {optionsNotFound: missingOptionsTexts} : null
}
function checkDisabledOptionsTexts() {
const disabledOptionsTexts = texts.filter(text => optionByText(text).disabled);
return disabledOptionsTexts.length > 0 ? {disabledOptions: disabledOptionsTexts} : null
}
return checkState(select) || checkMissingOptionsTexts() || checkDisabledOptionsTexts() || applyChanges(select, () => {
for (let requestedPartialText of texts) {
optionByText(requestedPartialText).selected = 'selected'
}
})
})(arguments[0], arguments[1])
© 2015 - 2025 Weber Informatics LLC | Privacy Policy