0

I have a problem with RobotFramework code. Im trying to make an If/ELSE and testing some functionalities but when I declare the Keyword I get the error: "Keyword 'SeleniumLibrary.Input Text' expected 2 arguments, got 10."

I tried changing the variables of the Keywords but nothing.

*** Settings ***
Library           SeleniumLibrary

*** Variables ***
${WEB}            https://google.es    #Url we are going to open
${BROWSER}        chrome    #Browser to use
${SELENIUM_DELAY}    1

*** Test Cases ***
Conditional Test    q    Different from 0    Equal to 0

*** Keywords ***
Open Browser
    Log To Console    Opening browser...
    Open Browser    ${WEB}    ${BROWSER}
    Maximize Browser Window

Conditional Test
    [Arguments]    ${textview}    ${text}    ${text2}
    Open Browser
    Input Text    ${textview}    ${text}    if    ${SELENIUM_DELAY}    !=    0
    ...    ELSE    Input Text    ${textview}    ${text2}

I just tried to make a condition that if the value of ${SELENIUM_DELAY} is different from 0, then write on google search a String.

1 Answer 1

4

The syntax for conditional execution is different, you have to use the keyword Run Keyword If, providing the keywords to run when the condition is true/false (the false is optional). Like this:

Run Keyword If    ${SELENIUM_DELAY} != 0    Input Text    ${textview}    ${text}
    ...    ELSE    Input Text    ${textview}    ${text2}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.