The Python Oracle

Missing elements when using selenium chrome driver to automatically 'Save as PDF'

This video explains
Missing elements when using selenium chrome driver to automatically 'Save as PDF'

--

Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Unforgiving Himalayas Looping

--

Chapters
00:00 Question
02:19 Accepted answer (Score 4)
02:57 Thank you

--

Full question
https://stackoverflow.com/questions/5494...

Question links:
[https://github.com/coolwanglu/pdf2htmlEX]: https://github.com/coolwanglu/pdf2htmlEX
[image]: https://i.stack.imgur.com/dBKTr.png
[image]: https://i.stack.imgur.com/hInP1.png
[http://chromedriver.chromium.org/downloa...]: http://chromedriver.chromium.org/downloa...
[image]: https://i.stack.imgur.com/9LA4I.png
[http://chromedriver.chromium.org/downloa...]: http://chromedriver.chromium.org/downloa...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #seleniumwebdriver #seleniumchromedriver

#avk47



ACCEPTED ANSWER

Score 4


So, through fiddeling around, I came by the solution by accident. I don't really understand why, but enabling the 'PrintBrowser mode' ("Enables PrintBrowser mode, in which everything renders as though printed.") solves the issue. This may or may have to do with CSS loading properly.

I just need to add chrome_options.add_argument('--enable-print-browser') and all elements are there!