0

I have this simple twill code

>>> from twill.commands import *
>>> go("http://stackoverflow.com:80")
==> at http://stackoverflow.com:80
'http://stackoverflow.com:80'
>>> showlinks()
1. log in ==> /users/login
2. careers ==> http://careers.stackoverflow.com
3. chat ==> http://chat.stackoverflow.com
4. meta ==> http://meta.stackoverflow.com
5. about ==> /about

I know I can do

>>> follow('careers')
 ==> at http://careers.stackoverflow.com
'http://careers.stackoverflow.com'
>>>

but how do i specify the link number, for example,

>>> follow(2) 

does not work?

The reason is that I want to test a website which has many links and I want to build the list of the links I want to follow.

How would one do this?

Thanks

khr055
  • 28,690
  • 16
  • 36
  • 48
khinester
  • 3,398
  • 9
  • 45
  • 88

1 Answers1

2

twill's follow function expects a string as an argument. try something like the following:

>>> follow('2') or >>> follow(str(2))

dfetter88
  • 5,381
  • 13
  • 44
  • 55