这是一个什么样的对话框?我如何使用 Puppeteer 与它交互? [英] What kind of dialog box is this? How can I interact with it using Puppeteer?

查看:57
本文介绍了这是一个什么样的对话框?我如何使用 Puppeteer 与它交互?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 puppeteer 运行 Google Chrome 浏览器(我也尝试过使用 Chromium)来生成 PDF,然后我使用 URL 将 PDF 发送到其他一些软件.我被这个对话框卡住了.

I'm using puppeteer to run a Google Chrome browser(I've tried with Chromium as well), to generate a PDF and then I'm using the URL to send the PDF to some other software. I'm getting stuck at this dialog box of sorts.

我认为这是一个普通的对话框,并尝试了点击确认"按钮的常用方法.我似乎无法让它工作.我无法向您显示我使用获取此显示的 URL,因为它很敏感.

I assumed it was a normal dialog box and have tried the usual method of hitting the "confirm" button. I can't seem to get it to work. I'm unable to show you the URL I am using the get this to show up, as it is sensitive.

正如我提到的,page.on() 似乎没有抓住这个框.

As I mentioned, page.on() doesn't seem to catch the box.

    const newP = await browser.newPage();
    newP.on('dialog', async dialog => {
            console.log(dialog.message());
            console.log(dialog.accept());
    });
    await newP.goto(`exampleURL`);```


推荐答案

无法从 DOM/页面访问此模式.您的浏览器似乎将打开的 PDF 文件重定向到您机器上的本地软件.解决方法:尝试断开连接或删除默认程序/软件.

This modal is not accessible from the DOM/Page. Your browser seem to redirect opening PDF files to local software on your machine. Solution: try to disconnecting or remove default program / software.

窗口:https://support.microsoft.com/en-us/help/4028161/windows-10-change-default-programs

麦克:https://www.macworld.co.uk/how-to/mac-software/change-default-apps-mac-3656510/

这篇关于这是一个什么样的对话框?我如何使用 Puppeteer 与它交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆