Having trouble interacting with popup windows.

1,465 views
Skip to first unread message

samir.m...@powwowmobile.com

unread,
Apr 18, 2017, 7:10:33 PM4/18/17
to headless-dev

Hi all,


I'm trying to use Headless Chrome (v60) to do some automated testing on an internal site that opens a popup window (using window.open).


I'm doing this from NodeJS using this excellent library https://github.com/cyrus-and/chrome-remote-interface that opens a websocket to headless Chrome.


All my operations work fine on the main window, but have trouble operating on the popup window.  I am able to detect the "Target.targetCreated" event that tells me the new window has popup up, and I can connect to the page using the new URL ws://localhost:9222/devtools/page/<popup_target_id>.


However, I don't get any DOM events in the popup and calls to "Runtime.evaluate" that operate on the DOM don't return anything.  "Page.captureScreenshot" doesn't return anything either.


I noticed that if I use the remote debugger to connect to headless Chrome, and go to a site that shows a pop-up, e.g.: http://www.popuptest.com/goodpopups.html, and then click on one of the "Good PopUp" links shows the popup window, and then I go to inspect the newly popped up page, the rendering of the page on the left is empty, although the HTML does show up in the DOM Debugger.


I'm running on MacOS, with this command line to start Chrome Canary:


/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --disable-gpu --headless --disable-popup-blocking --remote-debugging-port=9222


But I also get the same results using the Docker Linux image here: https://github.com/yukinying/chrome-headless-browser-docker


Is this a known issue?


Thanks,


--Samir


Samir Mahendra

unread,
Apr 20, 2017, 11:11:56 AM4/20/17
to headless-dev
I believe I'm running into this issue: https://bugs.chromium.org/p/chromium/issues/detail?id=696439

Has anyone been able to interact with popups in headless chrome using the remote debugger?  For me, the basic test:
1) Open a headless session and navigate to a page
2) "click" a link on a page that displays a popup using "window.open"
3) Connect to the popup page and take a snapshot

Is failing.

Thanks,

--Samir

Eric Seckler

unread,
Apr 20, 2017, 11:24:09 AM4/20/17
to Samir Mahendra, headless-dev
I think you you're right - you found the correct bug. Feel free to report your experiences there :)

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/05e66b47-4799-4426-a97c-8918a46f76d9%40chromium.org.

Samir Mahendra

unread,
Apr 20, 2017, 11:50:21 AM4/20/17
to headless-dev, samir.m...@powwowmobile.com
Thanks Eric.  I've updated issue 696439 with more information and a screencast recording of the bug.

Regards,

--Samir
Reply all
Reply to author
Forward
0 new messages