如果 HTML 代码如下所示,我如何检查复选框:
<input type="checkbox" name="tos_understood" style="background:none; border:none" />
所以,我的python代码是:
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
我应该在 tos_understood 部分写什么?没有选中复选框就无法登录。