提交自动填充(密码输入字段)

2024-03-06

I want to submit an autofilled password form using a userscript/tampermonkey in chrome. However it doesn't work - the fields the password field remains empty (server response or even with alert messages) until the window is actually controlled by a user (any actual keyboard press or mouse click). This seems important if you want a userscript to automate logins without hard-coding the passwords into your userscript.

有人对此有解释和/或解决方法吗?

我尝试了我知道的所有方法来提交表单:.submit() 或调度实际的鼠标单击事件等

自己尝试一下:在此处自动保存密码/名称:http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_PASSWORD.html http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_PASSWORD.html

附加信息:Tampermonkey 版本 3.12.58、chrome 版本 49.0.2623.110 m、Windows 10 64x。我还尝试停用 Chrome 中的所有扩展。

该页面附带的用户脚本:

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_PASSWORD.html
// @grant        none
// ==/UserScript==

//wait 5s to assert that chrome autofill had enough time to do its thing
setTimeout(function(){document.forms[0].submit()},5000)

编辑:循环永不提交的代码。

loopme()

function loopme() {
    setTimeout(function(){
        //check every second if 'password field' is empty, if not, submit the form
        if(document.forms[0].elements[1].value != ''){
            document.forms[0].submit()
        } else {
           //make count visible
           document.title = "|" + document.title
           //edit: adding an virtual 'click' makes no difference:
           //var mouseClick = new MouseEvent("click");
           //document.body.dispatchEvent(mouseClick);
           loopme()
           }
    },1000)
}


密码字段的屏幕截图,因为这个建议 https://bugs.chromium.org/p/chromium/issues/detail?id=378419基于 chrome bug。 左:提交前的表单,右:服务器响应。

运行循环脚本时 chrome 的(详细)日志文件:

Navigated to http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_PASSWORD.html
content: Started (5edc5230-099a-412a-bca4-48c97edb3113, http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_PASSWORD.html)
content: start event processing for 5edc5230-099a-412a-bca4-48c97edb3113 (1 to run)
env: initialized (content, id:5edc5230-099a-412a-bca4-48c97edb3113, http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_PASSWORD.html) 
env: schedule 'New Userscript' for document-idle
env: schedule for later events!
env: first DOMNodeInserted Event!
content: Started (d2f1e833-ce3f-48e8-a81c-cf4a93475a98, nullblank)
content: disable event processing for d2f1e833-ce3f-48e8-a81c-cf4a93475a98
content: Started (6b10cff5-a3a1-4eab-9286-f7e49aaa5952, http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_PASSWORD.html)
content: disable event processing for 6b10cff5-a3a1-4eab-9286-f7e49aaa5952
content: Started (dc4a5836-69a6-4194-a631-ad2354cc6a33, nullblank)
content: disable event processing for dc4a5836-69a6-4194-a631-ad2354cc6a33
env: DOMContentLoaded Event!
content: detected DOMContentLoaded 5edc5230-099a-412a-bca4-48c97edb3113
content: Started (df53f06c-55ba-4398-8a4d-0b41d2fb3f93, nullblank)
content: disable event processing for df53f06c-55ba-4398-8a4d-0b41d2fb3f93
env: execute script New Userscript @ the safe context now!
content: Started (069446ea-3b29-42c4-8c13-9f4f112f6a01, https://googleads.g.doubleclick.net/pagead/html/r20160331/r20151006/zrt_lookup.html)
content: disable event processing for 069446ea-3b29-42c4-8c13-9f4f112f6a01
content: Started (127600e6-61f8-4e15-862a-fe0aaa6e4683, http://s7.addthis.com/static/sh.953eb77977227bfd253ee158.html)
content: disable event processing for 127600e6-61f8-4e15-862a-fe0aaa6e4683
content: Started (b50036dc-266a-4328-92b9-6937c09419e3, https://googleads.g.doubleclick.net/pagead/ads)
content: disable event processing for b50036dc-266a-4328-92b9-6937c09419e3
content: Started (5df2993f-2fc5-4f40-8fa9-aa37c7ffd987, https://googleads.g.doubleclick.net/pagead/ads)
content: disable event processing for 5df2993f-2fc5-4f40-8fa9-aa37c7ffd987
content: Started (8f6c166e-6e61-4776-ba28-8caf786704f4, http://tpc.googlesyndication.com/safeframe/1-0-2/html/container.html)
content: disable event processing for 8f6c166e-6e61-4776-ba28-8caf786704f4
content: Started (c9082438-936d-4ba3-b76e-bf7cc9f48bae, https://googleads.g.doubleclick.net/pagead/ads)
content: disable event processing for c9082438-936d-4ba3-b76e-bf7cc9f48bae
content: Started (2439efaa-3ea5-461b-a8a1-25b2be866f1a, https://googleads.g.doubleclick.net/pagead/ads)
content: disable event processing for 2439efaa-3ea5-461b-a8a1-25b2be866f1a
content: Started (fdd7347c-3bf8-4e05-a9bb-97e0e26d543e, https://googleads.g.doubleclick.net/pagead/ads)
content: disable event processing for fdd7347c-3bf8-4e05-a9bb-97e0e26d543e
content: Started (5e2a844c-fe1e-4c8d-af07-09b3b1ab272c, https://googleads.g.doubleclick.net/pagead/ads)
content: disable event processing for 5e2a844c-fe1e-4c8d-af07-09b3b1ab272c
content: Started (0cef6828-3752-4b05-a8de-68cb90f6b29b, https://googleads.g.doubleclick.net/pagead/ads)
content: disable event processing for 0cef6828-3752-4b05-a8de-68cb90f6b29b
content: detected load 5edc5230-099a-412a-bca4-48c97edb3113
content: Started (65ce238d-9bd8-45cd-8d52-8d215ae3fe62, https://googleads.g.doubleclick.net/pagead/ads)
content: disable event processing for 65ce238d-9bd8-45cd-8d52-8d215ae3fe62
content: Started (c3747272-9bf6-4a6b-baf3-d38b7fbb8134, nullblank)
content: disable event processing for c3747272-9bf6-4a6b-baf3-d38b7fbb8134

由于似乎没有人可以回答:这是我在类似主题上找到的最佳答案(没有解释)。如果您发现或有更好的信息,请分享...

The 密码字段不会被填充(通过自动填充)没有用户的明确指示因此无法通过 javascript 访问。

From Stackoverflow 问题:JavaScript 可以访问自动填充的密码吗? https://stackoverflow.com/questions/32416926/can-javascript-access-autofilled-passwords

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

提交自动填充(密码输入字段) 的相关文章

  • Python Selenium:如何在文本文件中打印网站上的值?

    我正在尝试编写一个脚本 该脚本将从 tulsaspca org 网站获取以下 6 个值并将其打印在 txt 文件中 最终输出应该是 905 4896 7105 23194 1004 42000 放置的动物 的 HTML span class
  • 如何在发布期间复制未版本化的测试资源:执行?

    我的问题与 Maven 在发布时不会复制未跟踪的资源 https stackoverflow com questions 10378708 maven doesnt copy untracked resources while releas
  • CFdump cfcomponent cfscript

    可以在 cfcomponent 中使用 cfdump 吗 可以在 cfscript 中使用 cfdump 吗 我知道 anser 不是 那么如何发出 insde cfcomponent 函数的值 cf脚本 我用的是CF8 可以在 cfcom
  • 如何确定所有角度2分量都已渲染?

    当所有 Angular2 组件完成渲染时 是否会触发一个角度事件 For jQuery 我们可以用 function 然而 对于 Angular2 当domready事件被触发 html 只包含角度组件标签 每个组件完成渲染后 domrea
  • 如何在执行新操作时取消先前操作的执行?

    我有一个动作创建器 它会进行昂贵的计算 并在每次用户输入内容时调度一个动作 基本上是实时更新 但是 如果用户输入多个内容 我不希望之前昂贵的计算完全运行 理想情况下 我希望能够取消执行先前的计算并只执行当前的计算 没有内置功能可以取消Pro
  • 使用.NET技术录制屏幕视频[关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 有没有一种方法可以使用 NET 技术来录制屏幕 无论是桌面还是窗口 我的目标是免费的 我喜欢小型 低
  • 如何从日期中查找该月的最后一天?

    如何在 PHP 中获取该月的最后一天 Given a date 2009 11 23 我要2009 11 30 并给出 a date 2009 12 23 我要2009年12月31日 t返回给定日期所在月份的天数 请参阅的文档date ht
  • 从超立方体图像中获取文本的确切位置

    使用 tesseract 中的 GetHOCRText 0 方法 我能够检索 html 中的文本 并在 webview 中呈现 html 时 我能够获取文本 但图像中文本的位置与输出不同 任何想法都非常有帮助 tesseract gt Se
  • Vue.js[vuex] 如何从突变中调度?

    我有一个要应用于 json 对象的过滤器列表 我的突变看起来像这样 const mutations setStars state payload state stars payload this dispatch filter setRev
  • CSS溢出文本显示在几行中,没有断字

    我有一些长文本显示在 div 中 该 div 具有固定的宽度和高度 我希望文本显示在几行上 作为 div 高度 并且句子单词不会中断 一行中的单词前缀和下一行中的继续 此外 我想在末尾添加省略号最后一句话 CSS white space n
  • 节拍匹配算法

    我最近开始尝试创建一个移动应用程序 iOS Android 它将自动击败比赛 http en wikipedia org wiki Beatmatching http en wikipedia org wiki Beatmatching 两
  • Spring Boot @ConfigurationProperties 不从环境中检索属性

    我正在使用 Spring Boot 1 2 1 并尝试创建一个 ConfigurationProperties带有验证的bean 如下所示 package com sampleapp import java net URL import j
  • 循环内的异步性

    我正在使用 jQuery getJSON 用于从一组实用程序的给定 URL 检索数据的 API 我真的很想找到一种为每个实用程序重用代码 完全相同 的方法 由于循环的执行与 ajax 调用无关 因此我无法找到保留循环值的方法 我知道这个描述
  • neo4j - python 驱动程序,服务不可用

    我对 neo4j 非常陌生 我正在尝试建立从 python3 6 到 neo4j 的连接 我已经安装了驱动程序 并且刚刚开始执行第一步 导入请求 导入操作系统 导入时间 导入urllib 从 neo4j v1 导入 GraphDatabas
  • rspec 中的模拟方法链

    有一系列方法可以获得user目的 我试图模拟以下内容以返回user in my Factory Girl current user AuthorizeApiRequest call request headers result 我可以模拟该
  • 如何使用 Pycharm 安装 tkinter? [复制]

    这个问题在这里已经有答案了 I used sudo apt get install python3 6 tk而且效果很好 如果我在终端中打开 python Tkinter 就可以工作 但我无法将其安装在我的 Pycharm 项目上 pip
  • 如何将输入读取为数字?

    这个问题的答案是社区努力 help privileges edit community wiki 编辑现有答案以改进这篇文章 目前不接受新的答案或互动 Why are x and y下面的代码中使用字符串而不是整数 注意 在Python 2
  • NotImplementedError:无法将符号张量 (lstm_2/strided_slice:0) 转换为 numpy 数组。时间

    张量流版本 2 3 1 numpy 版本 1 20 在代码下面 define model model Sequential model add LSTM 50 activation relu input shape n steps n fe
  • Erlang dict的时间复杂度

    我想知道 Erlang OTP 是否dict模块是作为哈希表实现的 在这种情况下它是否能提供这样的性能 平均情况 Search O 1 n k Insert O 1 Delete O 1 n k 最坏的情况下 Search O n Inse
  • 如何在react-highcharts中使用图表工具提示格式化程序?

    如何使用图表工具提示格式化程序 我正在使用高图表的反应包装器 我有这样的配置 const CHART CONFIG tooltip formatter tooltip gt var s b this x b each this points

随机推荐