Unable to access textbox on an HTML form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ATNC33
    New Member
    • Sep 2012
    • 7

    Unable to access textbox on an HTML form

    I've solved this problem... I had a little error on the path of the frame that i have to open to reach the form.

    Now the form is being opened, but i can't find the login text box.

    Can you help me @Rabbit?

    Here is the code and the text message:

    Code:
     def login(self):
            url = self._baseUrl + '/webapp/commerce/safilo/jsp/logon.jsp?lng=E&cpy=10'
            self._br.open(url, timeout=30.0)
            self._br.select_form(name='logon') 
            print 'entrou'
            self._br.form['login'] = self._username
            self._br.form['password'] = self._password
            self._br.submit()
            
            if self._verbose: print 'Login successful.\n'
            
            self.last_logged_in = datetime.datetime.now()
    
    Traceback (most recent call last):
      File "E:\billy\Projects\GlassInteg\trunk\src\run.py", line 90, in <module>
        go()
      File "E:\billy\Projects\GlassInteg\trunk\src\run.py", line 39, in go
        ss = SafiloSupplier(updateBrands=True)
      File "E:\billy\Projects\GlassInteg\trunk\src\GlassInteg\Supplier.py", line 283, in __init__
        if login: self.login()
      File "E:\billy\Projects\GlassInteg\trunk\src\GlassInteg\Supplier.py", line 307, in login
        self._br.form['login'] = self._username
      File "build\bdist.win32\egg\mechanize\_form.py", line 2780, in __setitem__
      File "build\bdist.win32\egg\mechanize\_form.py", line 3101, in find_control
      File "build\bdist.win32\egg\mechanize\_form.py", line 3185, in _find_control
    mechanize._form.ControlNotFoundError: no control matching name 'login'
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    @ATNC33, we try to limit threads to one question each. Since this is a new question, I have branched it from the original thread: http://bytes.com/topic/python/answers/943035-error-form.

    Comment

    • ATNC33
      New Member
      • Sep 2012
      • 7

      #3
      @Rabbit Thank you for your help! ;)

      Comment

      • dwblas
        Recognized Expert Contributor
        • May 2008
        • 626

        #4
        File "build\bdist.wi n32\egg\mechani ze\_form.py", line 3185, in _find_control
        mechanize._form .ControlNotFoun dError: no control matching name 'login'
        It appears there is no "login" on the form you are accessing. Print it to see what you have as the login page is apparently at a different location.

        Comment

        Working...