英文:
Pass command to KiTTY UI
问题
I wish to automate the below task
- Launch KiTTY
- Enter username and password
- Login successfully
- Enter this below command to see the logs
tail -2000f /apps/test/good.log
I am able to achieve up to point 3 using below code
from subprocess import Popen
Popen("powershell kitty-0.73.1.1.exe sakthi@x.y.w.z -pw YYYY")
(new KiTTY windows is opened and user is logged in successfully)
But I don't know how to pass the below command
tail -2000f /apps/test/good.log
Note:
I am using Python3
I WANT THIS AUTOMATION AT UI LEVEL. I have around 5 to 6 log files to go through while testing. I don't want to open all the logs manually. So I am looking for a way to automate it.
I am using KiTTY, because it can re-connect automatically when there is any network problem.
英文:
I wish to automate the below task
- Launch KiTTY
- Enter username and password
- Login successfully
- Enter this below command to see the logs
tail -2000f /apps/test/good.log
I am able to achieve up to point 3 using below code
from subprocess import Popen
Popen("powershell kitty-0.73.1.1.exe sakthi@x.y.w.z -pw YYYY")
(new KiTTY windows is opened and user is logged in successfully)
But I don't know how to pass the below command
tail -2000f /apps/test/good.log
Note:
I am using Python3
I WANT THIS AUTOMATION AT UI LEVEL. I have around 5 to 6 log files to go through while testing. I don't want to open all the logs manually. So I am looking for a way to automate it.
I am using KiTTY, because it can re-connect automatically when there is any network problem.
答案1
得分: 2
KiTTY,以及PuTTY,都有-m
命令行开关,用于提供SSH“exec”通道的命令。
这在:https://stackoverflow.com/q/39361444/850848 中有讨论。
KiTTY另外还有-cmd
命令行开关,与-m
相反,它模拟SSH“shell”通道上的按键输入。这相当于KiTTY的“自动命令”功能。
还请参阅 https://stackoverflow.com/q/22536723/850848。
虽然如果你想自动化测试,最好使用本地的Python SSH模块,比如Paramiko。
英文:
KiTTY, as well as PuTTY, has -m
command-line switch to provide a command for SSH "exec" channel.
This is discussed in: https://stackoverflow.com/q/39361444/850848
KiTTY additionally has -cmd
command-line switch, which (contrary to -m
) simulates key strokes on SSH "shell" channel. It is an equivalent of KiTTY "Automatic Command" feature.
See also https://stackoverflow.com/q/22536723/850848
Though if you want to automate testing, you better use a native Python SSH module, like Paramiko.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论