playwright-python
playwright-python copied to clipboard
[Bug]: can not download a file. when page to be close with alert
Version
1.55
Steps to reproduce
<html>
<body>
<!--StartFragment-->
<script>
(function () {
for (var i = 1; i <= 4; i++) {
var input = 'input_' + i;
input = document.createElement("input")
input.type = "hidden"
input.value = Math.random()
document.body.appendChild(input)
}
})()
document.body.addEventListener('click', function () {
alert(" ");
window.location.href = 'test.exe';
});
</script>
<!--EndFragment-->
</body>
</html>
Expected behavior
download file and the subsequent logic will be executed normally
Actual behavior
download is going on, but the subsequent logic code not works.
Additional context
GPT tell me, after "alert" page was freed , the expect_download bind on the page .so it not works. GPT tell me there is a context.expect_download. and it's not exists.
Environment
- Operating System: [Ubuntu 22.04]
- CPU: [amd64]
- Browser: [All, Chromium]
- Python Version: [3.12]
You can check the docs: https://playwright.dev/python/docs/downloads
You can check the docs: https://playwright.dev/python/docs/downloads
GPT tell me that browser think "window.location.href" is a navigation, not a download. how to capture this download type bypass trick.thanks, what should we change browser driver or python sdk?