用Python填写Ajax表单
我正在尝试使用mechanize模块来填写一个ajax框中的表单(我自己称之为ajax框),但似乎不太成功。我不是一个网页程序员,但据我所知,ajax框会在内容变化时自动更新,这个过程是由浏览器处理的。
看起来mechanize模块无法处理这种情况。在链接列表中(通过迭代器Browser.links获取),我发现了一个链接是'javascript:AjaxRetry();',并且它的文本显示有错误信息,告诉我出现了问题。
这是我的代码:
import mechanize as m
br = m.Browser()
br.open(url)
br.select_form(nr=0)
# fill in one form (in a real browser, the other form refresh and are not disabled anymore)
br.set_value(code, br.form.controls[10].name)
# how to make it refresh now?
#br.submit() doesn't work (also br.click() does not work (no clickable around at all))
请问mechanize模块适合用来填写这个ajax框的表单吗?
我无法分享这个ajax框所在页面的链接,因为你必须先登录才能看到这个框。