admin管理员组文章数量:1122846
Browser act as file is downloaded, I can see the file in the panel, but I can't open folder or click on the link in the panel, nor find the file in its designated downloadpath or anywhere else. Worked fine with chrome v121.
test outputs: 20241122162434|ERROR|downloadpath:C:\dist\work\remote-eseal-fullstack-test
So I know it is executing the cdp command. But nothing in downloadpath, or anywhere else.
Same Chrome the usual way work all fine, but not via selenium. Not manual in this window either.
All active chrome settings below extracted:
elif os.environ['WEBDRIVER'].lower()=='chrome':
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
options.add_argument('--disable-gpu')
options.add_argument('--log-level=3')
options.add_argument('--default-shm-size=32m')
options.add_argument('--disable-translate')
options.add_argument('--disable-extensions')
options.add_argument("--disable-search-engine-choice-screen") #from v127
ptions.add_argument("--proxy-server='direct://'")
options.add_argument("--proxy-bypass-list=*")
options.set_capability('acceptInsecureCerts', True)
s = ChromeService(log_output="./chromedriver.log", service_args=['--append-log', '--readable-timestamp', '--log-level=DEBUG'])
driver = webdriver.Chrome(service=s, options=options)
if downloadpath:
params = {'behavior': 'allow', 'downloadPath': downloadpath}
driver.execute_cdp_cmd('Page.setDownloadBehavior', params)
log.error(f"downloadpath:{downloadpath}")
Chromedriver: 131.0.6778.69, Chrome: 131.0.6778.86, Selenium: 4.26.1, win11
In chromedriver.log I see this:
[11-22-2024 15:50:50.149][INFO]: [8910dee67519a9b5866d52afebfbf3c1] COMMAND ExecuteCDP {
"cmd": "Page.setDownloadBehavior",
"params": {
"behavior": "allow",
"downloadPath": "C:\\dist\\work\\remote-eseal-fullstack-test"
}
}
[11-22-2024 15:50:50.149][INFO]: Waiting for pending navigations...
[11-22-2024 15:50:50.149][DEBUG]: DevTools WebSocket Command: Runtime.evaluate (id=11) (session_id=61E316801F90E64FADC42C44338093B5) A4E93A55626FB44C23A9F9249BA7239F {
"expression": "1"
}
[11-22-2024 15:50:50.150][DEBUG]: DevTools WebSocket Response: Runtime.evaluate (id=11) (session_id=61E316801F90E64FADC42C44338093B5) A4E93A55626FB44C23A9F9249BA7239F {
"result": {
"description": "1",
"type": "number",
"value": 1
}
}
[11-22-2024 15:50:50.150][INFO]: Done waiting for pending navigations. Status: ok
[11-22-2024 15:50:50.150][DEBUG]: DevTools WebSocket Command: Page.setDownloadBehavior (id=12) (session_id=61E316801F90E64FADC42C44338093B5) A4E93A55626FB44C23A9F9249BA7239F {
"behavior": "allow",
"downloadPath": "C:\\dist\\work\\remote-eseal-fullstack-test"
}
:
<down to last entry mentioning the pdf>
:
[11-22-2024 15:50:55.321][DEBUG]: DevTools WebSocket Event: Page.windowOpen (session_id=D072486C5680E0BC8FE19F80C8467224) 9A5B198EA74FBCFC94BF48195F3EB3B8 {
"url": "https://**********/remote-eseal-demo-web/signed/buypass-finse-2022_signed.pdf",
"userGesture": true,
"windowFeatures": [ "menubar", "toolbar", "status", "scrollbars", "resizable", "noopener" ],
"windowName": "_blank"
}
本文标签:
版权声明:本文标题:python - Chrome Selenium show file downloaded but I can't find it or click the file in download panel - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736302379a1931513.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论