12

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

我已经尝试过mech.form.click("submit"),但这给出了以下错误:

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

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

有任何想法吗?谢谢。

4

1 回答 1

21

type="button"纯 html表单中单击 a什么也不做。为了让它做任何事情,必须有javascript参与。

并且mechanize不运行javascript

所以你的选择是:

  • 自己阅读 javascript 并模拟mechanize它会做什么
  • 用于spidermonkey运行 javascript 代码

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

于 2009-11-27T00:30:53.213 回答