1

My code worked perfectly until yesterday when I updated Google Chrome to version 110.0.5481.77. Now it's not working in headless mode:

options.add_argument("--headless")

I even tried adding options.add_argument("--window-size=1280,700") but still not working. Although if I remove the headless option it again works correctly!

Masked Man
  • 2,176
  • 2
  • 22
  • 41

1 Answers1

7

Accroding to this answer and Google Chrome release notes you should add the headless mode option like below:

options.add_argument("--headless=new")

and no need to specify the window size

Masked Man
  • 2,176
  • 2
  • 22
  • 41
  • But it seems by default uses a small resolution. It seems to be something like 800x600. – Paulo Oliveira Apr 11 '23 at 09:28
  • 1
    @PauloOliveira My use case is well served by the default, but I think you can use the `options.add_argument("--window-size=1280,700")` to justify that. If that doesn't solve feel free to provide a more accurate answer. – Masked Man Apr 11 '23 at 16:38
  • 1
    Does not work for me on 112 stable or 113 beta. – Paulo Oliveira Apr 14 '23 at 03:59
  • @PauloOliveira I've got no idea, if you could figure it out post an answer. – Masked Man Apr 15 '23 at 00:23
  • This works with Chrome 114 and Chromium 114. Nothing else worked for me. Strange thing is, that for other sites I can use the options.add_argument("--headless") version, but for one specific site I can't – erdomester Jun 20 '23 at 21:51