मुख्य सामग्री पर जाएं

दृश्यमान पाठ द्वारा चयन

तर्क से मेल खाने वाले प्रदर्शित पाठ वाले विकल्प का चयन करें।

उपयोग
$(selector).selectByVisibleText(text)
पैरामीटर्स
नामप्रकारविवरण
textString, Numberचयनित किए जाने वाले विकल्प तत्व का पाठ
उदाहरण
example.html
<select id="selectbox">
<option value="someValue0">uno</option>
<option value="someValue1">dos</option>
<option value="someValue2">tres</option>
<option value="someValue3">cuatro</option>
<option value="someValue4">cinco</option>
<option value="someValue5">seis</option>
</select>
selectByVisibleText.js
it('demonstrate the selectByVisibleText command', async () => {
const selectBox = await $('#selectbox');
console.log(await selectBox.getText('option:checked')); // returns "uno"
await selectBox.selectByVisibleText('cuatro');
console.log(await selectBox.getText('option:checked')); // returns "cuatro"
})

Welcome! How can I help?

WebdriverIO AI Copilot