【问题标题】:NodeJS Puppeteer Block PopupsNodeJS Puppeteer 阻止弹出窗口
【发布时间】:2020-03-11 04:55:16
【问题描述】:

基本上,我只是想在 shopify 网站上填写一些输入字段,但是在进行到一半时,我从该网站收到了一个 iframe 弹出窗口,其中包含某种销售,这显然会导致输入输入失败。

我很好奇是否有任何参数可以添加到浏览器中来阻止弹出窗口?我试过了

--enable-popup-blocking

但这似乎不起作用。

如果没有其他方法可以关闭弹出窗口?

感谢任何帮助!

【问题讨论】:

  • 一个草率的解决方法是在你的类型完成后添加一个if (popup != null){ click to exit the popup, delete what you have in the input field, reenter input and then move on)"。或者如果它总是出现,那么只需等待它然后在输入之前退出它。我知道这不是您想要的,但它会完成工作。

标签: node.js iframe arguments puppeteer


【解决方案1】:

https://github.com/GoogleChrome/puppeteer/blob/v0.12.0/docs/api.md#class-dialoghttps://github.com/GoogleChrome/puppeteer/blob/v0.12.0/docs/api.md#event-dialog

如果弹出窗口是自定义 HTML,那么您必须编写自己的逻辑来从 DOM 中删除弹出窗口

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-04
    • 1970-01-01
    • 1970-01-01
    • 2017-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-05
    相关资源
    最近更新 更多