我正在开发一个脚本,用于对软件安装进行回归测试。期望代码如下。在浏览并同意许可文件的情况下,前几行代码运行良好。但是,脚本在“请输入有效许可证文件的路径名:”处停止,并且不执行任何操作。(注:手动安装顺利进行)。
另外,请注意所有输入的光标始终位于显示文本的右侧;但在最后一个提示(“请输入有效许可证文件的路径名:”)的情况下,光标位于文本下方和下面的行中。我不确定这是否与这个问题有关。
我究竟做错了什么?我该如何调试这个问题?感谢大家的帮助。
谢谢纳齐尔
这是代码:
#!/usr/bin/expect
spawn ./temp
expect {
"More--*" {
send " "
exp_continue
}
"Do you accept this license agreement?*" {
send "yes\r"
}
}
expect "Do you want to use the default path?*" { send "yes\r" }
expect "This load path does not exist. Do you want to create it?*" { send "yes\r" }
expect "Please enter the pathname to a valid license file:*" { send "/path_to_file\r" }
interact
下面是输出的样子:
.....(license stuff)
Do you accept this license agreement? [no] yes
Please specify where the xxx software will be loaded.
The default location is /usr/local/aaa.
Do you want to use the default path? [yes] yes
The software will not run without a valid license file installed.
Please enter the pathname to a valid license file: