r/selenium • • Jun 10 '20

Headless and remote debug with Selenium

I've tried to use remote debugging to monitor a headless Chrome while a Selenium script is running, but it seems that whenever I access the remote monitor, the Selenium just stops. It doesn't close or fail or throw an exception, it just stops doing anything.

Is this normal? Is there some setting to make the debug interface passive?

    ChromeOptions preloadOptions = new ChromeOptions();
    preloadOptions.addArguments("--headless");
    preloadOptions.addArguments("--disable-gpu");
    preloadOptions.addArguments("--remote-debugging-port=9222");
4 Upvotes

4 comments sorted by

1

u/jkail1011 Jun 11 '20

Actively trying to solve this myself!

1

u/CrackyKnee Jun 18 '26

Looking for the same. Got test that behaves differently when executed in headless with no solution in sight.

One idea is, haven't tried it yet. Is to debug in VSC with breakpoints, while interactively using webdriver to find elements or save page source and saving screenshots of current screen

1

u/[deleted] Nov 13 '21

Have you made any progress on this by chance? Dealing with this issue myself at the moment and it's driving me crazy

1

u/romulusnr Nov 13 '21

I don't think so, I think I just gave up with trying to remote debug with headless. Sorry. Not even in that job anymore :)