javascript - How to click with mechanize in python? - Stack Overflow

i have a form which is used for authentication.but in this form there are no submit button but it has

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
 |  Show 1 more ment

2 Answers 2

Reset to default 2

That'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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745566782a4633441.html

相关推荐

  • javascript - How to click with mechanize in python? - Stack Overflow

    i have a form which is used for authentication.but in this form there are no submit button but it has

    16小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信