【问题标题】:Puppeteer: Can't access iframe elements after update from 2.1 to 3.1 with built-in firefoxPuppeteer:使用内置 firefox 从 2.1 更新到 3.1 后无法访问 iframe 元素
【发布时间】:2020-05-28 13:00:48
【问题描述】:

我最近将我的 puppeteer 版本从 2.1 更新到了 3.1。我在以前的版本上使用了 pupeteer-firefox。现在由于 pupeteer 3.1 内置了 firefox,我正在使用它。但这只是 pupeteer 的一个实验性功能。

此代码在以前的版本中正常工作。

        const elementHandle = await page.$("iframe[src^=\"https://docs.google.com/picker\"] [id=\":7\"]")
        await elementHandle.click()

复制步骤

现在将打开一个 iframe。我需要在 iframe 中单击带有 id=":7" 的元素并输入图像 url。有人能帮帮我吗?

【问题讨论】:

    标签: google-maps firefox iframe puppeteer


    【解决方案1】:

    这是puppeteer的firefox官方测试结果。

    https://hg.mozilla.org/mozilla-central/file/tip/remote/puppeteer-expected.json

    针对iframe 的每个测试都是FAILSKIP

    而且 google 不会在 pupeteer 中支持 firefox。

    所以我得出的结论是,使用 pupetteer 访问 iframe 是不可能的,尤其是在跨站点脚本被禁止的情况下。

    我已经放弃了 puppeteer 并开始使用微软的剧作家。一切都很顺利。

    【讨论】:

      【解决方案2】:

      请注意,Google 并未致力于在 Firefox 中支持 Puppeteer。正如您已经说过的那样,Firefox 支持现在处于实验阶段。也就是说,我们正在努力为各种功能和 API 添加更好的支持,但这不是一周内就能完成的任务。

      关于你的问题,我可以说我最近添加了对很多 API 的 iframe 支持,现在 Firefox 79 中都可以使用。

      另请注意,Playwright 正在使用基于最新 Firefox 测试版的经过修改的非官方 Firefox 构建。

      【讨论】:

        猜你喜欢
        • 2021-07-21
        • 1970-01-01
        • 2013-08-05
        • 2014-09-03
        • 1970-01-01
        • 2023-02-21
        • 2021-03-02
        • 2020-05-04
        • 1970-01-01
        相关资源
        最近更新 更多