Search code examples
python-2.7robotframeworkrobotframework-ide

ExcelRobot - Robot Framework Ride - Import Issue


I have managed to import the ExcelRobot library into Ride and everything look normal since the name didnt got in red. enter image description here

When I go to the Test Case and call the keyword Open Excel, it shows the keyword is available. enter image description here

However, when I ran the Test Case, I got the error Importing test library 'ExcelRobot' failed: ImportError: No module named ExcelRobot

What can be wrong?


Solution

  • I'm not sure about the library that you are going to use. But I have used "ExcelLibrary" in my test suite and its perfectly working.

    1. Step 01: pip install robotframework-excellibrary
    2. Step 02: Check the library in your python path (Ex. C:\Python27\Lib\site-packages\ExcelLibrary)
    3. Step 03: Import the library in your test

    Example code:

    *** Settings ***
    Library           ExcelLibrary
    Library           String
    
    *** Variables ***
    ${ExcelLocation}    ExcelTestNumbers.xls
    ${ExcelOutputLocation}    ExcelTestNumbersOutput.xls
    ${ExcelSheetName}    Sheet1
    
    *** Test Cases ***
    NumberRotation
        NumberRotation
    
    *** Keywords ***
    NumberRotation
        ExcelLibrary.Open Excel    ${ExcelLocation}
        ${ExcelRowCount}    ExcelLibrary.Get Row Count    ${ExcelSheetName}
        Log to console    Excel_Row_Count_${ExcelRowCount}
        : FOR    ${LoopCycle}    IN RANGE    ${ExcelRowCount}
        \    Log to console    Loop_Rotation_${LoopCycle}
        \    ${CurrentProcessingNumber}=    ExcelLibrary.Read Cell Data By Coordinates    ${ExcelSheetName}    0    ${LoopCycle}
        \    Log to console    CurrentProcessingNumber_${CurrentProcessingNumber}
        \    ExcelLibrary.Put String to Cell    ${ExcelSheetName}    1    ${LoopCycle}    ExcelSave${LoopCycle}
        \    Save Excel    ${ExcelOutputLocation}
        \    Log to console    Saved
        \    ...    ELSE    NumberInvalid
    

    ExcelLibrary Keywords: http://navinet.github.io/robotframework-excellibrary/ExcelLibrary-KeywordDocumentation.html

    Hope this helps.

    cheers.