Hello everybody!
I have just started exploring TWILL.
Twill is an amazing scripting language for Web browsing and it does all I want!!!
So far I've been using twill from a Python shell (IDLE (Python GUI) to be precise) and I do things there in the way of executing commands one by one (I mean, I type one command, run it, then type the next command): But I don't know how to put all these commands together in one .py file, so that they would all be executed one by one automatically.
It seems that there is such possibility in twill. This example from the twill documentation page (you can see it HERE) shows us one piece of code consisting of several commands: So, my question is: How can I put all commands together in twill?
Update 1:
(this update is my response to S.Mark)
Hello, S.Mark!!! I am sorry for the late response. First of all, some info about the location of my twill and python related folders:
The path where Python2.5 is installed on my computer: C:\Python25
The path to my twill-0.9 on my computer now: E:\tmp\twill-0.9
Let’s say I want the following commands to be carried out automatically:
go http://www.yahoo.com
save_html result.html
This code should look into yahoo page and then save its HTML code into result.html file. So, trying to follow Your instructions, I firstly created “test.txt” file containing this code consisting of only 2 lines and saved that file as “test.twill” in the twill-0.9 folder, which means that the full path to that file now was E:\tmp\twill-0.9\test.twill
Then I tried to pass the file name as parameter to twill-sh command in many different ways, but it never worked (I must’ve been doing something wrong): But you know what, I decided to experiment a bit and created a test.py file that also contained only those two commands. This file I also placed in the twill-0.9 folder (E:\tmp\twill-0.9\test.py) and then I decided to try running it from twill shell using twill’s runfile command, and, surprisingly, it worked! :
After running it, I looked up my C:\Python25 folder and found the newly-created result.html file there!
Well, what I've done here is simply running a file from the twill shell using a twill command. While at the moment it is exactly what I need, other supporters (as you can see below) suggest I should do all things from python shell, not from twill shell, and that is something that I still don’t know how to do.
My next step will be to try running a similar code on “Google App Engine”, but there, as far as I know, only Python is recognized, not twill, which means that if I only know how to do things in twill, but not in python, I won’t be able to have “Google App Engine” execute my commands.
Update 2:
(Friday 23, April, 2010, 3:48:15 a.m.(GMT+0.00))
(This update is my second response to S.Mark)
It seems that running it from command prompt isn't successful either: