I want to block pop-ups when I open a new tab on Chromium

I searched for various information and didn’t find a way to block pop-ups. I tried the example below, but it doesn’t work.

Can someone help me?

Bellow my code

*** Comments ***
Documentation
… Suite with common system features
… Resources used in all scenarios

*** Settings ***
Library Browser
Library FakerLibrary locale=pt_BR

Variables
${url} https://google.com
${browser} chromium
${headless} true
*** Keywords ***
Wait
Sleep 5

Open Website
Set Browser Timeout 10
New Browser ${browser} headless=${headless} args=[‘–disable-notifications’,‘–disable-
infobars’,‘–ignore-certificate-errors’,‘–disable-popup-blocking’]

New Context viewport={‘width’: 1920, ‘height’: 1080}
New Page ${url}

Hi @TiuCadu ,

Firstly what sort of “pop-ups” are you trying to block?

  • is it a dialogue the the browser is producing
  • a new browser window/tab opening to another page
  • a browser dialogue telling about a certificate error
  • a simulated dialogue in the HTML page (more common these days)?

The options you’ve selected should prevent the first 3, but not the last one of the above list. The browser will always render the HTML, so if it’s in the HTML you’ll have to handle the simulated “pop-up”.

You can confirm what it is by opening dev tools and try to inspect an element of the “pop-up”.

Dave.

https://peter.sh/experiments/chromium-command-line-switches/

BlockquoteNew Browser ${browser} headless=${headless} args=[‘–disable-notifications’,‘–disable-
infobars’,‘–ignore-certificate-errors’,‘–disable-popup-blocking’]
Blockquote

I read, “I want to block pop-ups…”
I saw the command-line argument, “–disable-popup-blocking”
I might just drop command-line argument, “–disable-popup-blocking” and see what happens.