Hi.
After searching in doc I’m looking for some advice here, please help.
I try to add some logic using IF ELSE statement in my tests and stuck with assignments the variable the IF statement.
Brief overview:
I am testing create functionality in CMS, new record ‘name’ have to be unique value.
Before creating I have to check if the ‘name’ I choose is free and in case it is not free I delete record before creating, so here is the code snippet:
*** Settings ***
Resource …/…/resource.robot
*** Keywords ***
Check server not exist before attempt to create it
Go to CMS
Press Keys ${SearchField} ${hostname_value} RETURN
${count} = Get Element Count ${ThereIsNoRecordFound}
IF ${count} == 0
Delete server
END
My questio is how to assign ${count} successfully any time, no matter if there is an ${ThereIsNoRecordFound} or not on the page.
The main issue for me now - when there is no locator ${ThereIsNoRecordFound} on the page - test fails.
My expectation is - assign ‘0’ or ‘1’ to ${count} without error when there is no such locator on page (when there is something found and I have to delete record before creating new one in test)