How can I check checkbox if HTML code looks like:
<input type="checkbox" name="tos_understood" style="background:none; border:none" />
So, my python code is:
import urllib
import urllib2
import cookielib
authentication_url = 'http://test.com'
# Input parameters we are going to send
payload = {
'user': 'newuser',
'pass': '12345'
'tos_understood': ??????????
}
# Use urllib to encode the payload
data = urllib.urlencode(payload)
# Build our Request object
req = urllib2.Request(authentication_url, data)
print req
# Make the request and read the response
resp = urllib2.urlopen(req)
contents = resp.read()
print contents
What should I write in tos_understood section? There is no way to login without checked checkbox.
This should work:
payload = {
'user': 'newuser',
'pass': '12345',
'tos_understood': 'on',
}
did you try something like :
"tos_understood": "1"
"tos_understood": "checked"
or
"tos_understood": "on"
I looked around for an answer to this but couldnt really find much
If those dont work maybe try something like selenium that actually drives a browser with a window it is waaaayyy easier and you can also run it headless so that the window doesn't pop up
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With