I have a page where code is written in form of tr>td format . In this I have 4 rows and for all 4 rows have to select a value from drop-down. Note: The drop-down is same for all the rows. So below is my code
let i = 1;
for (i = 1; i < 5; i++) {
cy.xpath('//div[@id="#0"]/div[@id="panel1"]/div//table/tbody[@class="valueOne"]/tr["+ i +"]/td[8]/div[1]/div/a/span').click({
multiple: true,
force: true
});
let drop = [];
cy.xpath('//*[@id="Valves_chosen"]/div/ul/li[@class="active-result"]')
.each(($el, index) => {
drop.push($el.text())
cy.log($el.text())
})
cy.log(drop); // code is working fine till here
if (i == 1) {
drop.click(i - 1);
}
The only issue I am facing is that I am not able to select my desired index value from the "drop" list. And I want my code in "for" loop only because I can increase the rows in future i.e.. from 4 to 24.
Aucun commentaire:
Enregistrer un commentaire