Firefox 插件 - 无法触发任何类型的点击事件

Firefox addon - cannot trigger click event of any kind

我正在开发一个 firefox 插件,它将自动填充登录表单字段并登录。我有权访问的内容可能是从 id 的 类' 或 xpath 到登录按钮的任何内容,具体取决于网站提供的内容。捕获的优先级通常是 id,如果它们存在的话。不会触发点击的特定网站是:https://login.paylocity.com/escher/escher_webui/views/login/login.aspx

我尝试使用 $(element).trigger('click')$(element).click(),但它们都不会自动触发点击。控制台日志中的错误显示:

XrayWrapper denied access to property callee (reason: value is callable). See https://developer.mozilla.org/en-US/docs/Xray_vision for more information. Note that only the first denied property access from a given global object will be reported.

我也尝试了此处显示的 Javascript 方法:Is it possible to trigger a link's (or any element's) click event through JavaScript? 那也不管用。

XrayWrapper denied access to property callee

这表明脚本 运行 处于比页面内容本身具有更高权限的环境中,这反过来会导致一些安全障碍(一个方向的 xray wrappers,访问被拒绝另一个错误)因为调用者现在是部分特权代码,不允许访问其内容。

您可以尝试手动合成一个 DOM 事件并触发它,而不是使用 jquery,可能是通过访问不安全的 window.

new window.wrappedJSObject.MouseEvent("click") 类似的东西,dispatchEvent() 也一样。

或者,您也可以尝试在表单上触发提交事件而不是点击事件。

另一种方法是使 .callee 可通过 transplanting 调用函数进入内容 window。