I'm facing issue's on using if else condition in robot framework?

Viewed 53
*** Variables ***
${data}=    No data available in table

*** Keywords ***

Landing on Add Customer Page

    Click Element    ${btn_customers}

    Sleep    5 seconds

    Click Element    ${btn_customers1}

Verifying that customers is deleted or not.

    Set Selenium Speed    1

    Select From List By Value    ${select_dropdown}    100

    ${contains}    Input Text    ${txt_searchmail}      ${mail}

    Click Element    ${btn_search}

    ${Text}=   Page Should Contain    No data available in table


    # Log To Console    ${Text}
    # Run Keyword if  ${Text}==${Text}   No data Found
    # ...  ELSE IF  ${Text}!=${Text}    If user exist
    # ...  ELSE  Contains anything


    IF  ${data}==${Text}    No data Found  ELSE IF    ${data}!=${Text}    If user exist  ELSE   Not contains anything
    
If user exist

    Click Link    Edit

    Click Element    ${btn_delete}

    Set Selenium Implicit Wait    10 seconds

    Click Element    ${btn_float_delete}

    Page Should Contain    The customer has been deleted successfully.

No data Found
    Page Should Contain    No data available in table 

Not contains anything
    Log    pass

I'm using if else statement before adding a new user to check whether its existing or not? if exist then perform delete operation otherwise add new user. But facing issues on if else.

0 Answers
Related