Eu tenho o seguinte elemento no código
<sp-textfield id="library-name-textfield" data-testid="library-name-textfield" quiet="" placeholder="Name" dir="ltr" type="text" focusable="">
#shadow-root
<input class="input" type="text" aria-describedby="sp-help-text" aria-label="Yourname" placeholder="Your name">
</sp-textfield>
Eu tento fazer o seguinte:
await this.inputBrandLibNameTxtBox().waitFor({ state: "visible", timeout: 20000 });
await this.inputBrandLibNameTxtBox().fill(brandName);
onde:
inputBrandLibNameTxtBox = () => this.page.getByTestId("library-name-textfield").locator("input");
Recebo o erro:
TimeoutError: locator.fill: Timeout 20000ms exceeded.
Call log:
- waiting for getByTestId('library-name-textfield').locator('input')
- locator resolved to <input type="text" class="input" aria-label="Your brand name" placeholder="Your brand name" aria-describedby="sp-help-text-2f4953d1"/>
- fill("new-brand--1733244070919")
- attempting fill action
- waiting for element to be visible, enabled and editable
Como posso consertar isso?
Eu tentaria depurar isso com o bom e velho console.log e imprimir se esse elemento está retornando verdadeiro para a função isVisible()
Fora isso, você sempre pode esperar por algumas mudanças de estado como await this.element.waitFor( {state: "visible"} ) Além disso, você pode adicionar um tempo limite maior