How can I open excel file through ride in robot framework

送分小仙女□ 提交于 2019-12-13 23:06:30

问题


How can I open excel file through ride in robot framework. I am trying to Open Excel keyword but I am keep getting error "No such file or directory".


回答1:


You can follow my sample code below :

*** Settings ***
Library           Selenium2Library
Library           ExcelLibrary
*** Variables ***
${path_excel}    res/my_excel_file.xls

*** Test Cases ***
Test1
    Open Excel     ${path_excel}



回答2:


Also, another option if you prefer not to use a variable for the excel file -> Just store the excel file in the same folder as your project and one important thing to mention is that RIDE - Robot Framework does not support excel files that have the extension of .xlsx, if your excel file is .xlsx format, you will need to open it in excel and do a file save as .xls which is the older format. Once you do this and store the .xls file to your project folder (Which is usually in C:\Python27\Scripts\ProjectFolderName) you can use the following just replace the test.xls with the name of your .xls file:

*** Settings ***
Library    SeleniumLibrary
Library    ExcelLibrary

*** Test Cases ***
Test1
    Open Excel Current Directory     test.xls


来源:https://stackoverflow.com/questions/48511733/how-can-i-open-excel-file-through-ride-in-robot-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!