[Tutor] How to pass command line variables to this python code...

J Cook jcook713 at gmail.com
Wed Jul 15 17:06:55 CEST 2009


Yeah, I figured that. I got it to work thanks, but I still don't 
understand how exactly. Coming from Perl I am used to a more procedural 
type of programming. BTW - Selenium is a great tool for web testing, and 
the way it will translate your web clickstream into your choice of 
languages rocks.

Justin

vince spicer wrote:
> good catch, my mistake
> 
> args[1] == 'yankees'
> True
> 
> 
> On Wed, Jul 15, 2009 at 12:25 AM, Christian Witts 
> <cwitts at compuscan.co.za <mailto:cwitts at compuscan.co.za>> wrote:
> 
>     vince spicer wrote:
> 
>         First off, selenium is a great tool and the python driver is
>         very powerful
> 
>         there are numerous ways to access cli variables,
> 
>         the quickest
> 
>         import sys
>         print sys.srgv
> 
>         sys.argv will it output a array of all command line args
> 
>         ./selenium-google-test.py yankees
>         will out put:
> 
>         ['selenium-google-test.py', 'yankees']
> 
>         so
> 
>         args = sys.argv
> 
>         args[0] == 'yankees'
>         True
> 
>     That would be false, the first argument (list index zero) is the
>     script name.  You would need to do
>     args = sys.argv[1:]
>     if you want to dump the filename from the list.
> 
>     -- 
>     Kind Regards,
>     Christian Witts
> 
> 
> 


More information about the Tutor mailing list