முக்கிய உள்ளடக்கத்திற்குச் செல்லவும்

செலெக்ட்பைஅட்ரிபியூட்

குறிப்பிட்ட மதிப்புடன் ஆப்ஷனைத் தேர்ந்தெடுக்கவும்.

பயன்பாடு
$(selector).selectByAttribute(attribute, value)
அளவுருக்கள்
பெயர்வகைவிவரங்கள்
attributestringதேர்ந்தெடுக்கப்பட வேண்டிய ஆப்ஷன் எலிமென்ட்டின் பண்புக்கூறு
valueString, 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 name="someName5" value="someValue5">seis</option>
</select>
selectByAttribute.js
it('Should demonstrate the selectByAttribute command', async () => {
const selectBox = await $('#selectbox');
const value = await selectBox.getValue();
console.log(value); // returns "someValue0"

await selectBox.selectByAttribute('value', 'someValue3');
console.log(await selectBox.getValue()); // returns "someValue3"

await selectBox.selectByAttribute('name', 'someName5');
console.log(await selectBox.getValue()); // returns "someValue5"
});

Welcome! How can I help?

WebdriverIO AI Copilot