berstend / puppeteer-extra

💯 Teach puppeteer new tricks through plugins.
https://extra.community
MIT License
6.41k stars 739 forks source link

userPrefs.protocol_handlers.exclude_schemes property set with puppeteer-extra-plugin-user-preferences not working #875

Open racso-dev opened 7 months ago

racso-dev commented 7 months ago

Describe the bug I'm building a bot that integrates with meet, zoom and teams online meetings and that records the audio of a meeting.

My problem is that with teams and zoom, the xdg-open popup appears when I navigate to the invitation url, and It's blocking the rest of my scenario.

I came across many potential solutions. Including setting the user preferences of chrome (as described here or here) through the puppeteer-extra-plugin-user-preferences. The problem is that so far I haven't been able to make it work.

I also tried the basic example of the doc and setting the font size to something big enough for me to notice a difference and same it doesn't seem to be working cuz I can't see any difference.

To reproduce you can instantiate the following class with a valid zoom meeting invitation url. You should see the xdg-open popup. The schemes excluded should be good I checked with the network requests made and it matches.

Code Snippet

import { Page, Browser, Frame } from 'puppeteer'
import Puppeteer from 'puppeteer-extra'
import StealthPlugin from 'puppeteer-extra-plugin-stealth'

Puppeteer.use(require('puppeteer-extra-plugin-stealth')({
    userPrefs: {
        protocol_handler: {
            excluded_schemes: {
                'ms-teams': true,
                'zoommtg': true
            }
        }
    }
})).use(StealthPlugin())

export class RecorderBot {
    callUrl: string
    browser: Browser | null
    page: Page | null
    currentContext: Page | Frame | null

    constructor(callUrl: string) {
        this.callUrl = callUrl
        this.browser = null
        this.page = null
        this.currentContext = null
        this.init()
    }

    async init() {
        this.browser = await Puppeteer.launch({
            headless: false,
            args: ['--no-sandbox'],
            ignoreDefaultArgs: ['--mute-audio'],
            slowMo: 25,
        })
        this.page = await this.browser.newPage()
        this.currentContext = this.page
        await this.currentContext.goto(this.callUrl, { waitUntil: 'networkidle2' })
    }

    async scenario() { }
}

const url = "https://us05web.zoom.us/j/88515971549?pwd=XQPZsa4d2xUGASMDT5pryWgH2dxvk6.1"
const bot = new RecorderBot(url)

Versions System: OS: Linux 6.5 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish) CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz Memory: 19.41 GB / 31.06 GB Container: Yes Shell: 5.1.16 - /bin/bash Binaries: Node: 20.11.1 - /usr/bin/node npm: 10.2.4 - /usr/bin/npm pnpm: 8.15.3 - /usr/bin/pnpm npmPackages: puppeteer: ^22.0.0 => 22.0.0 puppeteer-extra: ^3.3.6 => 3.3.6 puppeteer-extra-plugin: ^3.2.3 => 3.2.3 puppeteer-extra-plugin-stealth: ^2.11.2 => 2.11.2 puppeteer-extra-plugin-user-preferences: ^2.4.1 => 2.4.1

Maybe important to precise, I'm running puppeteer in a ubuntu:22.04 based docker image in headfull mode sharing my X server with my host for dev, but the goal is to run in headless.

Smexey commented 2 months ago

I am facing a similar issue trying to disable xdg-open. Is there any fix?

AlkanV commented 2 months ago

i am facing exactly same issue, is there any solution for this?