我想使用机器人框架硒从excel表格中从第1列第7行到第20列获取数据。下面是我尝试执行任务的代码:
*** Settings ***
Library Selenium2Library
Library ExcelLibrary
Library Collections
*** Variables ***
${path_excel} D:\\Users\\thejav\\Desktop\\Robot_framework.xls
*** Test Cases ***
Test1
Open the Excel
*** Keywords ***
Open the Excel
open Excel ${path_excel}
${my_data}= Get Column values Robot_framework 0
Log ${my_data}
答案 0 :(得分:1)
对于我的建议,如果要存储大量数据,则应使用LIST。您可以在下面找到我的示例:
*** Settings ***
Library Selenium2Library
Library ExcelLibrary
Library Collections
*** Variables ***
${path_excel} D:\\Users\\thejav\\Desktop\\Robot_framework.xls
*** Test Cases ***
Test1
Open the Excel
*** Keywords ***
Open the Excel
${my_data_as_list}= Create List
open Excel ${path_excel}
:For ${i} in range 7 20
\ ${my_data} Read Cell Data By Name Robot_framework A${i}
\ Append To List ${my_data_as_list} ${my_data}
Log ${my_data_as_list}