Comments for Wait For Elements State

Topic for comments about Browser library keyword Wait For Elements State

Element States Issues
Pls, give me some tips on how to use states, because now the same error is listed. In this case, I wait until the element is not visible. Thnx.
RF 3.2.2, RED editor, python 3.10.2,

Could you raise an issue on Github?
I have to check that.

1 Like

I set this keyword to fail after 20 seconds but it seems to be taking 5min 31sec very often. Is there a known reason for the timeout limit being exceeded? Is there a way to avoid this, should I use Wait For Condition instead?

How to handle with multiple elements?
Example:
In a FOR loop keyword, theres is ONLY one element in DOM:
//p[.=“PĂłs-vacina/Serviços FarmacĂȘuticos”]
but after some actions, this there will be more of this element:
! handler execution failed: Error: locator.waitFor: Error: strict mode violation: locator(‘//p[.=“PĂłs-vacina/Serviços FarmacĂȘuticos”]’) resolved to 2 elements:
1)

PĂłs-vacina/Serviços FarmacĂȘuticos

aka getByText(‘PĂłs-vacina/Serviços FarmacĂȘ’).first()
2)

PĂłs-vacina/Serviços FarmacĂȘuticos

aka getByText(‘PĂłs-vacina/Serviços FarmacĂȘ’).nth(1)

Call log:

  • waiting for locator(‘//p[.=“PĂłs-vacina/Serviços FarmacĂȘuticos”]’) to be visible

How do I proceed?

Hi Matheus

try this xpath:

(//p[.=“PĂłs-vacina/Serviços FarmacĂȘuticos”])[1]

the part inside the brackets () can return multiple and the [1] says always take the first one, see XPath Syntax > Predicates for more detail

Dave.

1 Like

Thanks for the reply!
I’ll try this. Appreciate.