Topic for comments about Browser library keyword Wait For Elements State
Could you raise an issue on Github?
I have to check that.
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.
Thanks for the reply!
Iâll try this. Appreciate.

