通过 .value 属性更改文本后,提交按钮不可提交



我正在尝试自动化登录系统,但遇到了一些问题,我输入用户名和密码如下:

document.getElementById('username').value = 'hello'

正在对密码做同样的事情,但此方法不启用提交按钮,必须由我手动在每个字段中键入某些内容,以便在我通过 .value 编辑用户名和密码后出现。

有什么解决方法吗?

编辑:这是我尝试提交的按钮,如果它有帮助的话

<button type="submit" class="icon-login" ng-disabled="!loginForm.$valid" disabled="disabled"></button>

正在尝试提交到使用网络套接字的网页,这就是为什么我无法通过 POST 数据登录的原因。即使登录后,URL 也没有变化。

<script>
document.form[0].action="your_page_to_redirect"
document.getElementById('username').value="Hello"
document.form[0].onsubmit=function(){
window.location.href("your_url");
}
document.forms[0].submit();
</script>

这就是你想要的吗?

最新更新