Using urllib2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kaarthikeyapreyan
    New Member
    • Apr 2007
    • 106

    Using urllib2

    Am starting my homework on urllib2

    my first page which is a HTML has a username and password field and a login button

    Code:
    from urllib2 import urlopen
    from ClientForm import ParseResponse
    
    response = urlopen("http://172.16.0.200:8080/mypage.html")
    forms = ParseResponse(response, backwards_compat=False)
    print forms
    form = forms[0]
    print form
    
    original_text = form["userId"]
    form["userId"] = "XXX"
    
    original_text = form["password"]
    form["password"] = "YYY"
    
    print urlopen(form.click()).read()
    am able to successfully login
    this goes into a JAVAscript page which contains a link update
    Code:
    <a class=welcome href="javascript:login('up');">update</a>&nbsp;&nbsp;|&nbsp;
    when i added urlopen(form.cl ick("update")). read()
    It threw me an error stating that

    Code:
    ClientForm.ControlNotFoundError: no control matching name 'update', kind 'clickable'
    My motive is to click the link on the page how do i have to do it ?
Working...