'Not able to select a value from drop down using Index in Testcafe
Below is my code. I am able to access and select the item from drop down from a browser console using
'''document.querySelector('#__next > div > main > div.Home_toolbar__JY_RL >
div.Home_deviceControls__nQw4V > select:nth-child(2)').selectedIndex = 3'''
But from test in testcafe from below code -
''test('Select each available Audio input device', async (browser) => {
await browser.wait(6000);
let audioDevices = Selector('#__next > div > main >
div.Home_toolbar__JY_RL > div.Home_deviceControls__nQw4V >
select:nth-child(2)'
).selectedIndex = 3
await browser.expect(audioDevicescount.selectedIndex).eql(3);
});'''
Below is the error I get -
TypeError: Cannot set property selectedIndex of function __$$clientFunction$$() { const testRun = builder._getTestRun(); const callsite...... } which has only a getter
I tried using client function, but could not pass the selectedIndex value.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
