【发布时间】:2025-12-27 23:25:12
【问题描述】:
我正在尝试为提交表单编写一个 selenium 测试,它在提交时使用intercooler.js。我遇到的主要问题是,当我导航到页面时,表单有class="disabled",这不是预期的行为,我无法提交表单。 intercooler 文档的相关部分说:
默认情况下,中冷器会将禁用的类应用于元素 触发中冷器请求。这可以用来给出一个 给用户的视觉提示,他们不应该点击或以其他方式 再次触发请求,并且是 Bootstrap 友好的。
但是,在我看来,在我实际提交表单之前已将禁用的类添加到表单元素中,据我所知,它应该只在请求进行中后添加。
当前表单如下所示:
<form ic-post-to="/dashboard/calculate/2/exports/" ic-select-from-response="#content" ic-target="#content" method="post" ic-src="/dashboard/calculate/2/exports/" ic-verb="POST" ic-trigger-on="default" ic-deps="ignore" class="disabled">
<input type="hidden" name="csrfmiddlewaretoken" value="...">
<input type="submit" name="new" value="New" class="btn btn-primary float-right ml-1" id="submit-id-new">
</form>
我已尝试添加 explicit 和 implicit 等待,以便加载整个页面,但问题仍然存在。
对此的任何帮助将不胜感激。
【问题讨论】: