Home > Software engineering >  No keyword with name "launch browser" found Robot Framework
No keyword with name "launch browser" found Robot Framework

Time:03-24

I have 2 files: in userkeywords.robot I have the test case file as follows:

\*\*\* Settings \*\*\*
Library     SeleniumLibrary
Library     OperatingSystem
Resource    ../Resources/resources.robot

\*\*\* Variables \*\*\*
${url}      https://login.salesforce.com/?locale=it
${browser}  chrome

\*\*\* Test Cases \*\*\*
TC1
${PageTitle}=   launch browser  ${url}      ${browser}
input text      id:username     user
input text      id:password     mypass

In the other: resources.robot I have all the keywords which I separated from the main file:

\*\*\* Settings \*\*\*
Library     SeleniumLibrary
Library     OperatingSystem

\*\*\* Keywords \*\*\*
launch browser
\[Arguments\]       ${appurl}   ${browser}
open browser    ${url}      ${browser}
maximize browser window

    ${title}=   get title
    
    [Return]    ${title}

For some reason I get the following error message:

PS C:\\temp\\TestCases\> robot .\\userkeywords.robot
TC1                                                                   | FAIL |
No keyword with name 'launch browser' found.

I am using VS code

I tried to put both files in the same folder but still get the error

CodePudding user response:

You need to include a line in your Settings section that says

Library | SeleniumLibrary

and you might also need to run

pip install --upgrade robotframework-seleniumlibrary

CodePudding user response:

You need to recheck where your resources.robot file present. I suspect Resource ../Resources/resources.robot causing this issue. Also, these '' all over may be something not present in your code, right?

  • Related