admin管理员组文章数量:1023579
i have a form which is used for authentication. but in this form there are no submit button but it has used an <input>
as a button . now i am confused how to click this type of button with MECHANIZE.
till now i had done this:
import urllib
import re
import mechanize
from base64 import b64encode
and can this be done in Java script?
br = mechanize.Browser()
response = br.open("");
#print response.code
#print response.geturl()
br.select_form("login")
br.form['j_username'] = 'user'
br.form['j_password'] = 'pass'
i have a form which is used for authentication. but in this form there are no submit button but it has used an <input>
as a button . now i am confused how to click this type of button with MECHANIZE.
till now i had done this:
import urllib
import re
import mechanize
from base64 import b64encode
and can this be done in Java script?
br = mechanize.Browser()
response = br.open("http://xyz.");
#print response.code
#print response.geturl()
br.select_form("login")
br.form['j_username'] = 'user'
br.form['j_password'] = 'pass'
Share
Improve this question
edited Aug 30, 2013 at 12:11
RATHI
asked Aug 29, 2013 at 21:39
RATHIRATHI
5,3099 gold badges43 silver badges48 bronze badges
6
-
br.form.submit()
doesn't work? – inspectorG4dget Commented Aug 29, 2013 at 21:42 - there is no method of br.form.sumbit() but after selecting the form we can submit the form by br.form() but it is giving this error: <response_seek_wrapper at 0x2d693a0 whose wrapped object = <closeable_response at 0x2d86fd0 whose fp = <socket._fileobject object at 0x02D7DA30>>> – RATHI Commented Aug 29, 2013 at 21:49
-
Sorry, I meant
br.submit
. See here and here – inspectorG4dget Commented Aug 29, 2013 at 21:52 - br.submit() should return another webpage but it returning some different thing which i have described in above ment. – RATHI Commented Aug 29, 2013 at 22:00
- 1 That's not an error. Read the response - it's a filelike object. response = br.form.submit() html = response.read() – DivinusVox Commented Aug 29, 2013 at 22:08
2 Answers
Reset to default 2That's not an error. Read the response - it's a filelike object.
br.select_form("login")
br.form['j_username'] = 'xyz'
br.form['j_password'] = 'pass'
pag2 = br.submit()
html = pag2.read()
print html
This is a submit button. A submit button in HTML is by definition an <input>
element of type submit
.
i have a form which is used for authentication. but in this form there are no submit button but it has used an <input>
as a button . now i am confused how to click this type of button with MECHANIZE.
till now i had done this:
import urllib
import re
import mechanize
from base64 import b64encode
and can this be done in Java script?
br = mechanize.Browser()
response = br.open("");
#print response.code
#print response.geturl()
br.select_form("login")
br.form['j_username'] = 'user'
br.form['j_password'] = 'pass'
i have a form which is used for authentication. but in this form there are no submit button but it has used an <input>
as a button . now i am confused how to click this type of button with MECHANIZE.
till now i had done this:
import urllib
import re
import mechanize
from base64 import b64encode
and can this be done in Java script?
br = mechanize.Browser()
response = br.open("http://xyz.");
#print response.code
#print response.geturl()
br.select_form("login")
br.form['j_username'] = 'user'
br.form['j_password'] = 'pass'
Share
Improve this question
edited Aug 30, 2013 at 12:11
RATHI
asked Aug 29, 2013 at 21:39
RATHIRATHI
5,3099 gold badges43 silver badges48 bronze badges
6
-
br.form.submit()
doesn't work? – inspectorG4dget Commented Aug 29, 2013 at 21:42 - there is no method of br.form.sumbit() but after selecting the form we can submit the form by br.form() but it is giving this error: <response_seek_wrapper at 0x2d693a0 whose wrapped object = <closeable_response at 0x2d86fd0 whose fp = <socket._fileobject object at 0x02D7DA30>>> – RATHI Commented Aug 29, 2013 at 21:49
-
Sorry, I meant
br.submit
. See here and here – inspectorG4dget Commented Aug 29, 2013 at 21:52 - br.submit() should return another webpage but it returning some different thing which i have described in above ment. – RATHI Commented Aug 29, 2013 at 22:00
- 1 That's not an error. Read the response - it's a filelike object. response = br.form.submit() html = response.read() – DivinusVox Commented Aug 29, 2013 at 22:08
2 Answers
Reset to default 2That's not an error. Read the response - it's a filelike object.
br.select_form("login")
br.form['j_username'] = 'xyz'
br.form['j_password'] = 'pass'
pag2 = br.submit()
html = pag2.read()
print html
This is a submit button. A submit button in HTML is by definition an <input>
element of type submit
.
本文标签: javascriptHow to click with mechanize in pythonStack Overflow
版权声明:本文标题:javascript - How to click with mechanize in python? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745566780a2156496.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论