python-3.x - 如何在机器人框架中遍历 Excel 工作表的所有行
问题描述
如何迭代 Excel 工作表的所有行。?
下面是我的代码
*** Settings ***
Library SeleniumLibrary
Library ExcelLibrary
Library Collections
*** Variables ***
${path_excel} C:\\User\\Test.xlsx
*** Test Cases ***
Test1
Test the ExcelData
*** Keywords ***
Test the ExcelData
${my_data_as_list}= Create List
#open the Excel ${path_excel}
open excel document filename=${path_excel} doc_id=Sheet2
FOR ${i} IN 20
${my_data}= Read Excel Cell row_num=${i} col_num=1
Log to Console ${my_data}
Append To List ${my_data_as_list} ${my_data}
Log to Console ${my_data_as_list}
END
它什么也没打印
PS C:\Users\User\PycharmProjects\RobotFramework\Automation> robot .\ExcelExtract.robot
==============================================================================
ExcelExtract
==============================================================================
Test1 None
[None]
Test1 | PASS |
------------------------------------------------------------------------------
ExcelExtract | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: C:\Users\User\PycharmProjects\RobotFramework\Automation\output.xml
Log: C:\Users\User\PycharmProjects\RobotFramework\Automation\log.html
Report: C:\Users\User\PycharmProjects\RobotFramework\Automation\report.html
我尝试了所有可能的在线搜索方法,也无法得到解决方案
解决方案
请
FOR ${i} IN 20
改为
FOR ${i} IN RANGE 1 20
推荐阅读
- c# - 为什么使用 ASP.NET MVC 更新数据库时不支持连接字符串关键字“服务器”
- azure-cosmosdb - Cosmos SQL API:基于数组条目的过滤器
- amazon-web-services - 使用单个构建规范文件在 CodeBuild 中运行批量构建
- c - 内存访问错误的原因是什么?
- node.js - 如何在用户点击节点通知程序之前保持通知状态?
- azure - 在 Azure 应用服务上使用 WebSocket 时的权衡?
- css - 如何在 Antd 的 Modal 中更改样式?
- reactjs - React 中的侧边栏条件渲染
- wordpress - Wordpress graphql(WPGraphQL)如何建立订阅
- logging - 如何获取服务容器日志并将其作为工件上传到 gitlab