How to click "Leave" google popup with puppeteer - puppeteer

I'm doing some tests using puppeteer when I need to do:
await page.goto("https://xpto1", {waitUntil: "networkidle2"});
Open a popup, How can I click in that popup using puppeteer?

Related

Follow new requests on google chrome devtools network tab

On my website, an AJAX script makes a lot of requests. I would like to have the network log scroll down to the newest requests automatically without me needing to do this. How would I do this on Chrome DevTools?
There is a somewhat cumbersome solution:
Open devtools-on-devtools.
Open devtools first and switch its Dock side in the menu to a detached (floating) window
in the now detached devtools press Ctrl+Shift+i or ⌘+⌥+i on MacOS,
which will open devtools-on-devtools in a new window
Run this code in devtools-on-devtools console:
setInterval(() => {
let scr = document.querySelector("div.network-waterfall-v-scroll")
scr.scrollTop = scr.scrollHeight
}, 3000);

window.open() opens a new electron browser window instead of native browser window

My electron desktop app loads an angular app into a browser window. That angular app has a button that should open a new website (lets say google.com as an example). When I use the following code...
<button (click)="openNew()">Open a new window</button>
openNew() {
window.open('www.google.com')
}
the app opens a new electron browser window. I want the window to open in a native browser window (chrome, firefox, internet explorer, etc). Can this be possible within an electron app?
Based on documentation, you can open links on OS default browser with code below
const { shell } = require('electron')
shell.openExternal('https://github.com')
Read for further information:
https://www.electronjs.org/docs/api/shell#shellopenexternalurl-options

Chrome extension Open homepage in new tab

I created a simple chrome extension. When user clicks on it, It will open a website in a new tab. My question is, I want my extension to open a new tab with given URL every time when user opens chrome browser.
browserAction.onClicked event handler worked in background.js

How to toggle Device Mode on a popup window in Chrome?

I have a web app with a chat that opens in a new popup window. Normally, in Chrome I can hit F12 and click the icon of a smart phone to toggle it. But in the popup window this icon does not appear. This is important for me since I need to throttle the connection of the popup in order to simulate a user disconnecting from the chat.
Thanks!
It doesn't seem to be currently possible. I've opened a ticket for you. Meanwhile you have couple of options:
open popup in a regular window (copy paste the url, or modify window.open call to open a new tab instead of a separate window),
create a Chrome extension that uses debugger API to send emulateNetworkConditions message to your popup window
or try hacking DevTools like so:
open DevTools (A) for your popup
focus on DevTools window and open another DevTools (B) for that window using a keyboard shortcut (F12/alt+cmd+J)
in the console of the DevTools B call WebInspector.overridesSupport.setEmulationEnabled(true) (to enable emulation) and then WebInspector.overridesSupport.settings.networkConditions.set({throughput: 1.5 * 1024, latency: 40}); (to enable network throttling)
Perhaps easier way as of today is to install chrome extension which will allow you to open preview in new tab instead of popup. There you can have the same icon to toggle to mobile. Below is the extension:
https://chrome.google.com/webstore/detail/tag-assistant-companion/jmekfmbnaedfebfnmakmokmlfpblbfdm?hl=en

Debugging Chrome extension default_popup using dev tools

I'm trying to do some simple debugging on a Chrome extension. When I try to catch an event ID and show it in an alert, Chrome immediately closes the alert and the default popup window making it impossible to tell what was in the alert. For instance:
$("a[data-toggle='pill']").on('shown.bs.tab', function (e) {
alert(e.target.id);
});
To instead log this to the console, I could do:
$("a[data-toggle='pill']").on('shown.bs.tab', function (e) {
console.log(e.target.id);
});
However, if I inadvertently close the popup or have to reload the extension, then the console window I opened using "inspect popup" on the popup will also be closed. This makes for a very tedious debug process.
What is a better approach to debugging and test Chrome extensions for the default_popup?
You can debug your chrome extensions like this
go to this link
chrome://inspect/#extensions
you can see your installed extensions and you can inspect them
:)
grab the link to the extension and change url to popup window url
in my ex: I changed background.html --> popup.html