PythonHeadlessChrome
PythonHeadlessChrome copied to clipboard
download not happening
Hi Shawn,
First thanks so much for writing this. I need headless download pretty bad so was excited to see you had something going. I have a JS heavy front end i need to be able to download in headless mode. Quite simply I can get your code running just fine, but it doesn't download. If I flip the headless flag my downloads happen. My assert fails after wait_for_file_to_exist times out. I wish I could share the page but it is private. Any idea on how to start debugging this would be helpful. I'm using:
Chrome Version 63.0.3239.108 (Official Build) (64-bit) ChromeDriver 2.34.522932 python selenium (3.8.0)
the failing code is the assert after:
wait_until_file_exists(actual_file, 10)
assert (os.path.isfile(actual_file))
i am getting this response after enable_download_in_headless_chrome():
response from browser: result:sessionId:1c43c8fa88866870389be5896efe77ed result:status:0 result:value:None
Update After more investigation it appears that I can successfully run your code with my config so it must be something with the page I'm trying to interact with in headless mode. I'm investigating further and post my findings here in case someone else runs into the issue.
Update 2 I've found that the page should open a new chrome tab when clicking download, download the file and then close the tab. After clicking download the new tab doesn't open in headless mode. So I'm investigating tabs now.
Hey @brandonwbrown ,
Did you manage to fix the tabs problem? I've just run into the same issue and been hitting the wall for a few hours already.
Best regards, Rafal
Hi @rafaljanicki,
Not yet sadly. I wasn't able to come up with a solution that worked so went back to headed mode. Please do let me know if you come up with anything. My research showed that it isn't possible yet:
https://bugs.chromium.org/p/chromium/issues/detail?id=696481#c113
But I'm happy to be wrong about that!
Thanks, Brandon
Thanks @brandonwbrown for the quick answer!
I've seen your message in the bugs thread and unfortunately, I'm not able to get this working as well - it just hangs up for me when I try to switch to the tab. Well, I guess we have to wait for a next release which hopefully will fix that.
Have a great day, Rafal
Anyone got any updates on this in the past year?