使用这两种方法之间有什么区别:
cy.get('.wtv').find('.sub-wtv');
cy.get('.wtv').within(() => {cy.get('.sub-wtv');});
来自文档
https://docs.cypress.io/api/commands/find.html
https://docs.cypress.io/api/commands/within.html
它们都让我们可以使用“子 DOM”,在其中我们可以做任何我们想做的事情,比如搜索特定元素并断言它。
所以我有一个从0到27的整数数组.
for(i<0; i<28; i++)
{
ListId[i] = i;
}
Run Code Online (Sandbox Code Playgroud)
我想要做的是从该数组中选择一个数字并随机地在另一个数组中重新排序.
我试图通过一个标志,数字-1替换已经选择的数字:
for(i<0; i<28; i++)
{
RandomId[i] = i;
ListId[i] = i;
}
srand(time(NULL));
for(i=0; i<28; i++)
{
res = rand() % 27;
aux = ListId[res];
if (ListId[res] != -1)
{
RandomId[i] = aux;
ListId[res] = -1;
}
else
i--;
}
printf("New list of integers: ");
for(i=0; i<28; i++)
{
printf("%d | ", RandomId[i]);
}
Run Code Online (Sandbox Code Playgroud)
但最终变成了无限循环.
希望可以有人帮帮我.
先感谢您