How to wait for different elements while don’t get error TimeoutException, it would possible?
I’ve discovered that my result page change elements xpath depending on result, after search I found a only unique button that have the same class in both results, I can use to wait the page content load
/html/body/app-root/app-acompanhamento/div/button/span
/html/body/app-root/app-acompanhamento-validacao/app-excecao-simplificada/div/div[3]/button/span
The same button have different xpaths
But class is the same
Button code of fail page result:
<button _ngcontent-bnf-c124="" fxlayoutalign="end" mat-raised-button="" class="mat-focus-indicator botao secundario laranja mat-raised-button mat-button-base" style="place-content: stretch flex-end; align-items: stretch; flex-direction: row; box-sizing: border-box; display: flex;">
<span class="mat-button-wrapper"> Entendi </span>
<div matripple="" class="mat-ripple mat-button-ripple"></div>
<div class="mat-button-focus-overlay"></div>
</button>
Success with button
<button _ngcontent-ngc-c136="" mat-stroked-button="" class="mat-focus-indicator botao normal secundario laranja alinhado-botao botao-final mat-stroked-button mat-button-base" style="margin-top: 15px;">
<span class="mat-button-wrapper">Entendi </span>
<div matripple="" class="mat-ripple mat-button-ripple"></div>
<div class="mat-button-focus-overlay"></div>
</button>
How to call by wait element block?
The result is:
>> Wait for Element (PuppeteerWaitForElement) <<
Waited for element with Class mat-button-wrapper
>> Get DOM (PuppeteerGetDOM) <<
Got the full page DOM
Apparently everything is ok, but I can’t capture the keycheck because the data hasn’t loaded yet.
Maybe the button is loading first then data, so I still need wait different elements
Some trick to do it?
I was wondering if something like that can be possible:
IF the xpath A exists = wait for element A
IF the xpath B exists = wait for element B
For now I’m using delay block but I will certainly get problems in real job situation with connections problems
Thanks