samedi 30 janvier 2016

How to Send Data in web form which has readonly attribute Using Python

Following is The Element I am trying to Send .

<input type="text" name="Date" id="Date" readonly="readonly"
                        class="calOnward"  onfocus="resetTxt(this, 'Depart On');"
                        value="Depart On"
                        /> 

I tried the Following Code :

import re
from mechanize import Browser

browser = Browser()
browser.open("Some-Site-With-Date.com")

browser.select_form(nr=0)
browser['Date']='08/04/2016'

response = browser.submit()

content = response.read()

print content

When I ran this code I am getting the Following Error:

   File "build\bdist.win32\egg\mechanize\_form.py", line 2784, in __setitem__
alueError: control 'Date' is readonly

Is there any Workaround for this to send this Date attribute? I am new to Python and any lead is appreciated.




Aucun commentaire:

Enregistrer un commentaire