关键字“ExcelLibrary.Open Excel Document”需要 3 个参数,得到 2 个

问题描述 投票:0回答:1

我需要一些帮助:
我的 Linux 命令是在 Excel 中设置的

我的目标是从 Excel 到远程服务器执行此命令

code001 echo "SELINUX=disabled" \> /etc/selinux/config
code002 timedatectl set-local-rtc no
code003 timedatectl set-timezone Asia/Tokyo
code004 localectl set-locale LANG=ja_JP.UTF-8
code005 echo "fs.suid_dumpable=2" \> /etc/sysctl.conf
code006 echo "Compress=no" \> /etc/sytemd/coredump.conf
code007 echo "DefaultLimitCORE" \> /etc/systemd/system.conf
code008 echo "d /var/lib/systemd/coredump 0755 root root 7d" \> /usr/lib/tmpfiles.d/systemd.conf
*** Settings ***
Library           ExcelLibrary
Library           SSHLibrary

*** Variables ***
${EXCEL_FILE}     D:/dev/linuxcommands.xlsx
${SHEET_NAME}     Sheet1
${HOST}           192.168.100.117
${USERNAME}       root
${PASSWORD}       Hitokiri
${PORT}           22

*** Test Cases ***
Execute Excel Commands On Remote Server
    [Setup]    Open Excel Document    ${EXCEL_FILE}    ${SHEET_NAME} 
   mode=w
    ${ssh}    Open Connection    ${HOST}    port=${PORT}
    ${ssh}.Login    ${USERNAME}    ${PASSWORD}
    ${rows}=    Get Row Count    ${SHEET_NAME}
    :FOR    ${row}    IN RANGE    1    ${rows}
    \    ${command}=    Read Cell Data By Name    ${SHEET_NAME} 
   Command${row}
    \    Run Keyword If    '${command}' != ''    Execute Command On Remote Server    ${ssh}    ${command}
    [Teardown]    Close All Connections

现在我附加 mode=w 它解决了问题,但出现另一个错误:

Execute Excel Commands On Remote Server                     | FAIL |
No keyword with name '${ssh}.Login' found.

但是出现这个错误:

Execute Excel Commands On Remote Server                     | FAIL |
No keyword with name '${ssh}.Login' found.                                 

提前谢谢你

excel pycharm robotframework
1个回答
0
投票

从错误消息中,在我格式化您的代码后,我们可以看到登录的关键字调用使用的是

${ssh}.Login
而不是
SSHLibrary.Login

(Robot Framework 的版本是多少?从 3.2.1 版本开始不再使用 FOR 的格式。)

© www.soinside.com 2019 - 2024. All rights reserved.