mechanize python单击一个按钮

nun*_*nos 12 python mechanize button

我有一个带<input type="button" name="submit" />按钮的表单,希望能够点击它.

我试过mech.form.click("submit")但是出现了以下错误:

ControlNotFoundError: no control matching kind 'clickable', id 'submit'

mech.submit() 也不起作用,因为它的类型是按钮而不是提交.

有任何想法吗?谢谢.

nos*_*klo 21

单击type="button"纯HTML的形式什么都不做.要做任何事情,必须涉及到javascript.

并且mechanize不运行javascript.

所以你的选择是:

  • 自己阅读javascript并模拟mechanize它将要做的事情
  • 使用spidermonkey运行JavaScript代码

我会做第一个,因为使用spidermonkey似乎很难,可能不值得.

  • 这是很久以前的事了,但是“机械化刺激”是什么意思? (2认同)