问题
I am looking for a way to fill basic authorization popup in Safari 13 in automated session. I want to log in to website which require such login. Solution can be even manual. Is there any way to do that?
List of solution which I tried:
- Fill form manually. Issue: Safari 13 blocks any interaction with automated browser. As far as I know there is no way to do it and then continue with automated session.
- Use selenium to fill the form. Issue: Safari does not support such feature.
- Use http://login:password@site.com. Issue: Safari 13 does not support such feature.
- Add authorization header using proxy. Issue: Some sites does not work the same with proxy. I tried browsermob-proxy and mitmproxy but site did not works the same as without proxy.
- Add authorization header using proxy and then refresh page without proxy. Issue: Header is not saved in browser. Authorization is required after refresh.
- Use ApplyScript or other to fill the form. Issue: Safari 13 blocks any interaction with automated browser.
- Safari extension with authorization header. Issue: as far as I know safari extension does not support any headers modification.
- Use Keychain access. Issue: It can not be used in automated session.
回答1:
Based on a few GitHub issues, I'm not sure if this is possible to achieve given all of the workarounds you have already tried.
This issue is detailing the Safari basic auth issue, closed as out-of-scope for Selenium: https://github.com/SeleniumHQ/selenium/issues/5610
Which a Selenium developer then links to a still-open, larger-scope issue, in the WebDriver spec repository: https://github.com/w3c/webdriver/issues/385
It seems like the basic auth support you are looking to achieve needs to be implemented by W3C contributors, not by Selenium developers.
All of the solutions you have mentioned trying seem to be the only available workarounds out there, and without a supported Selenium solution or fully-functioning workaround, this issue may not be solvable.
来源:https://stackoverflow.com/questions/58999783/safari-13-basic-authorization-in-webdriver