0

Here is the html of the page in which I want to login

<FORM NAME="form" METHOD="POST" ACTION="./memberlogin" onsubmit="this.onsubmit= function(){return false;}">


<table class='loginTbl' border='1' align="center" cellspacing='3' cellpadding='3' width='60%'>
   <input type="hidden" name="hdnrequesttype" value="1" />
   <thead>
   <tr>
    <td colspan='3' align="middle" class='loginHead'>Login</td>
   </tr>
   </thead>

   <tbody class='loginBody'>

   <tr>
    <td class='loginBodyTd1' nowrap="nowrap">Employee ID</td>
    <td class='loginBodyTd2'><input type='text' name='txtmemberid' id='txtmemberid' value='' class='loginTextBox' size='30' maxlength='8'/></td>
    <td class='loginBodyTd3' rowspan='2'><input type="submit" class="goclearbutton" value="  Go  "></td>
   </tr><input type='hidden' name='txtmemberpwd' id='txtmemberpwd' value='' />

   </tbody>

   <tfoot>
    <tr>
        <td colspan='3' class='loginFoot'>
            <font class='loginRed'>New Visitor?</font>

            <a href="mailto:admin@libsys.co.in?subject=New Registration&body=New Registartion Request">Send</a> your registration request to library !

           </td>
       </tr>
   </tfoot>

   </table>
   </form>

I've done bit of research on google and found that I've to use requests object or urllib or mechanize. All this is very confusing , please tell me the simplest method to do so.

Satwik
  • 1,281
  • 4
  • 18
  • 31

1 Answers1

0

For convenience, I recommend you use the PhantomJS

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

phantom = webdriver.PhantomJS()

phantom.get('http://www.mypage.com.br')

form_consultation = phantom.find_element_by_id('txtmemberid')
form_consultation.send_keys('1234')
phantom.find_element_by_class_name('goclearbutton').click()
macabeus
  • 4,156
  • 5
  • 37
  • 66