Hi, I am new with Expect. I am trying to connect to the Equipment1 that connected to the Router1 port# 2036. In DOS telnet, I can just type "telnet router1-mr 2036", hit Enter, then Enter again, then it will prompt me password. to elaborate, after telnet and hit 1st Enter, it will display BLANK until I hit the 2nd Enter, then it prompt "Password?", then I enter "00" for password, then I and run any command. Not sure why, but this is how the equipment setup.
#!c:/expect/bin/expect.exe
#
spawn telnet "lsanca01-mr 2036"
expect_before
send "\r"
send "\r"
expect "Password"
send "00\r"
I got an ERROR:
spawn telnet router1-mr 2036
router1-mr 2036: No data record of requested type.
send: invalid spawn id (exp_spawn0)
while executing
"send "00\r""
(file "./test.exp" line 9)
I think the problem cause by that after telnet, it shows BLANK until I enter the 2nd time, then it prompts "Password:". Is there a work around for this? Something like if Nothing after spawn telnet, then send /r again so it can get to the password prompt? Thanks in advance.
#!c:/expect/bin/expect.exe
#
spawn telnet "lsanca01-mr 2036"
expect_before
send "\r"
send "\r"
expect "Password"
send "00\r"
I got an ERROR:
spawn telnet router1-mr 2036
router1-mr 2036: No data record of requested type.
send: invalid spawn id (exp_spawn0)
while executing
"send "00\r""
(file "./test.exp" line 9)
I think the problem cause by that after telnet, it shows BLANK until I enter the 2nd time, then it prompts "Password:". Is there a work around for this? Something like if Nothing after spawn telnet, then send /r again so it can get to the password prompt? Thanks in advance.