使用用于Chrome浏览器的Selenium Web驱动程序执行自动化测试时,如何弹出NTLM身份验证?

cod*_*123 6 selenium python-3.x

我使用以下python代码绕过NTLM弹出窗口。

chromedriver = webdriver.Chrome(executable_path=chromedriver_path, chrome_options=options)
chromedriver.get("https://username:password@url.com")

Run Code Online (Sandbox Code Playgroud)

弹出窗口无法绕过,仍然存在,并且测试中断。

kus*_*hav 5

您可能会遇到域登录问题,因为浏览器将域分隔符转换\/和凭据无效。使用编码的分隔符%5C,它会起作用。

浏览器将转换https://domain\username:password@URLhttps://domain/username:password@URL.

请求的用户编码分隔符。
https://domain\username:password@URL=>https://domain%5Cusername:password@URL