前面的博文中已经实现了使用selenium library登录百度并搜索(windows 7系统 http://blog.csdn.net/justheretobe/article/details/52918100)。今天说说如何登录linux服务器并执行命令行,这样就可以使用robotframework获取前、后台的数据进行比较判断了。
先看实现代码:
代码:
*** Settings ***
Documentation ssh示例
Suite Setup Open Connection And Log In
Suite Teardown Close All Connections
Library SSHLibrary
*** Variables ***
${HOST} 10.1.1.1
${USERNAME} root
${PASSWORD} Test123456
*** Test Cases ***
Execute Command And Verify Output
[Documentation] Execute Command can be used to ran commands on the remote machine.
... The keyword returns the standard output by default.
${output}= Execute Command