I need help. I’m using the Browser Library robot framework to automate a work application. However, I encountered the following challenge, trying to validate the names of existing columns in a simple way works:
Get Text //span[text()='CPF'] contains CPF
Get Text //span[text()='CNS'] contains CNS
Get Text //span[text()='Nascimento'] contains Nascimento
Get Text //span[text()='Nome'] contains Nome
Get Text //span[text()='Nome da mãe'] contains Nome da mãe
Get Text //span[text()='UF'] contains UF
Get Text //span[text()='Município'] contains Município
Get Text //span[text()='Carteiras'] contains Carteiras
Wanting to make something more technical, I tried to implement it as follows:
${element} Set Variable css=thead tr td span
Wait For Elements State ${element}
... visible 5
Get Text ${element} contains CPF
Get Text ${element} contains CNS
Get Text ${element} contains Nascimento
Get Text ${element} contains Nome
Get Text ${element} contains Nome da mãe
Get Text ${element} contains UF
Get Text ${element} contains Município
Get Text ${element} contains Carteiras
Then the following error is displayed:
Error: locator.waitFor: Error: strict mode violation: locator(‘div .novaListagem table thead tr td span’) resolved to 8 elements: 1) CPF aka getByRole(‘cell’, { name: ‘CPF’, exact: true }).locator(‘span’) 2) CNS aka getByText(‘CNS’) 3) Nascimento aka getByText(‘Nascimento’, { exact: true }) 4) Nome aka getByRole(‘cell’, { name: ‘Nome’, exact: true }).locator(‘span’) 5) Nome da mãe aka getByText(‘Nome da mãe’) 6) UF aka getByText(‘UF’) 7) Município aka getByText(‘Município’) 8) Carteiras aka getByText(‘Carteiras’)
The expected result is that in validation it checks whether it contains the columns CPF, CNS, Birth, Name, Mother’s name, State, Municipality, Licenses.