Package expedient :: Package common :: Package tests :: Module client :: Class Browser
[hide private]
[frames] | no frames]

Class Browser

source code


Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
get_form_inputs(self, doc) source code
 
get_select_choices(self, doc, select_name)
parse the doc (a string), and return a dictionary of all options and their values
source code
 
get_checkbox_choices(self, doc)
parse the doc (a string), and return a dictionary of name->text.
source code
file-like object (see urllib2.urlopen)
get_form(self, url)
Get the form at 'url'
source code
file-like object (see urllib2.urlopen)
get_and_post_form(self, url, params, del_params=[], post_url=None)
Get the form at 'url', modify named parameters by those in 'params', then submit at 'post_url' or 'url' if 'post_url' is unspecified.
source code
 
login(self, url, username, password)
Log in at the given URL.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

get_checkbox_choices(self, doc)

source code 

parse the doc (a string), and return a dictionary of name->text. The checkboxes should be of the following format: <input type="checkbox" name="something">text</input>

get_form(self, url)

source code 

Get the form at 'url'

Parameters:
  • url (string) - URL to get the form from.
Returns: file-like object (see urllib2.urlopen)
response from urllib2.urlopen

get_and_post_form(self, url, params, del_params=[], post_url=None)

source code 

Get the form at 'url', modify named parameters by those in 'params', then submit at 'post_url' or 'url' if 'post_url' is unspecified. Return response.

Parameters:
  • url (string) - URL to get the form from.
  • params (dict) - parameters to update the form with.
  • post_url (str or None) - (optional) URL to post the form to. If None then port to url instead.
  • del_params (list of str) - list of parameter names to delete from form. These parameters are not submitted.
Returns: file-like object (see urllib2.urlopen)
response from urllib2.urlopen

login(self, url, username, password)

source code 

Log in at the given URL.

Parameters:
  • url (str) - url of the login page.
  • username (str) - username to use for login.
  • password (str) - password to use for login
Returns:
True on success, False otherwise.