waitForClickable
Aguarde por um elemento durante a quantidade de milissegundos fornecida para ser clicável ou não clicável.
informação
Ao contrário de outros comandos de elemento, o WebdriverIO não aguardará que o elemento exista para executar este comando.
Uso
$(selector).waitForClickable({ timeout, reverse, timeoutMsg, interval })
Parâmetros
Nome | Tipo | Detalhes |
---|---|---|
options opcional | WaitForOptions | opções de waitForEnabled (opcional) |
options.timeout opcional | Number | tempo em ms (padrão definido com base no valor de configuração waitforTimeout ) |
options.reverse opcional | Boolean | se verdadeiro, espera pelo oposto (padrão: false) |
options.timeoutMsg opcional | String | se existir, substitui a mensagem de erro padrão |
options.interval opcional | Number | intervalo entre verificações (padrão: waitforInterval ) |
Exemplo
waitForClickable.js
it('should detect when element is clickable', async () => {
const elem = await $('#elem')
await elem.waitForClickable({ timeout: 3000 });
});
it('should detect when element is no longer clickable', async () => {
const elem = await $('#elem')
await elem.waitForClickable({ reverse: true });
});
Retorna
- <Boolean>
return
:true
se o elemento for clicável (ou não se a flag estiver definida)