O'Reilly logo

Python Testing Beginner's Guide by Daniel Arbuckle

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - Twill scripting

We'll write a Twill script that checks whether a site obeys the same interface that we used for interacting with slashdot.org, and then applies it to a few different web sites to see what happens.

  1. Create a file called slashdot.twill containing the following code:
    code 200
    follow Science
    code 200
    formvalue 2 fhfilter "aardvark"
    submit
    code 200
    find aardvark
    
  2. Now, we'll run that script on http://slashdot.org/ and see whether it works.
    $ twill-sh -u http://slashdot.org/ slashdot.twill
    
    
    Time for action - Twill scripting
  3. All right, that worked nicely. So, let's see if espn.com works the same way as slashdot.org did.
$ twill-sh -u http://espn.com/ slashdot.twill ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required