if there appears text on a page after hitting a button.
the only thing it is in is a class, like so:
<label class="err">2 van de 3 velden Eiwit, Koolhydraten, Vet zijn leeg.</label>
with what should you verify?
I tried:
Page Should Contain Textfield err
but that's not the way to go I think
*** Keywords ***
Open Browser To Login Page
Open Browser ${LOGIN URL} ${BROWSER}
Maximize Browser Window
Set Browser Implicit Wait 5
Set Selenium Speed ${DELAY}
Login Page Should Be Open
Login Page Should Be Open
Title Should Be Hippe testautomatisering getest i.c.m. testtechnieken
Go To Login Page
Go To ${LOGIN URL}
Login Page Should Be Open
Input Username
[Arguments] ${username}
Input Text voedselnaam ${username}
Input Password
[Arguments] ${password}
Input Text Eenheid ${password}
Input Text Kcal ${password}
Input Text Eiwit ${password}
Submit Credentials
Click Element getdata
page should contain //label[@class='err'] 2 van de 3 velden Eiwit, Koolhydraten, Vet zijn leeg.
Welcome Page Should Be Open
Location Should Be ${LOGIN URL}
Title Should Be Welcome Page
There are various options choose which suites you most
Using Keywords
If you want exact text match then use
Element Text Should Be //label[@class='err'] 2 van de 3 velden Eiwit, Koolhydraten, Vet zijn leeg.
If you want substring in text
Element Should Contain //label[@class='err'] velden
It waits until the locator with text appears on page , I think another option to suffice to serve you verify text
Wait Until Element Contains locator text
This will verify text on entire page so it may be present multiple times on page or only single time
Wait Until Page Contains text_you_want_to_verify_on_page
Using Locators
to match complete text
//label[text()="2 van de 3 velden Eiwit, Koolhydraten, Vet zijn leeg."]
to match partial text
//label[contains(text(),'velden')]
and pass it to one of keyword which verifies element on page. for more option you can explore here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With