Ahmad Saifullah
Ahmad Saifullah

Reputation: 9

Get File (txt or csv) in Robot Framework

I created a text file that has 1 value in it by using Create File keyword

${getDateLetter} =    getValue        name=date
createFile              Resources\\Client\\DateLetter.txt      ${getDateLetter}

In other script, I'm trying to read the value in text file using Get File keyword

Library     OperatingSystem

${dateLetter} =     getFile     Resources\\Client\\DateLetter.txt

But it will throw this error

Cell in table 'css=#tbl-letter' in row #2 and column #2 should have contained text 'getFile Resources\Client\DateLetter.txt'.

Upvotes: 0

Views: 15716

Answers (1)

dilip s
dilip s

Reputation: 11

*** Settings ***
Library           OperatingSystem

*** Test Cases ***
Test 1
    Keyword 1
    Keyword 2

*** Keywords ***
Keyword 1
    Create File    C:/temp/robot_test/test1.txt    Hello World...!!!    encoding=UTF-8

Keyword 2
    ${Test}    Get File    C:/temp/robot_test/test1.txt    encoding=UTF-8    encoding_errors=strict

This works for me, Can you specify what data you are writing into file.

Upvotes: 1

Related Questions