突然我在 FireFox
中遇到了这个登录问题
HTTP Status 401 - Authentication Failed: Error validating SAML message
type Status report
message Authentication Failed: Error validating SAML message
description This request requires HTTP authentication.
运行自动化脚本 (Selenium webdriver-Java) 时。
在手动测试的情况下,应用程序登录成功,但如果我清除cookie,则会显示上述错误消息。
有人可以告诉我这可能是什么原因吗?
注意
:我在 Chrome 中没有遇到任何此类问题。
最佳答案
WebDriver 总是启动新的 Firefox,它没有任何 Cookie、插件等。我希望您可以通过调用您的个人资料来避免此问题。请按照以下步骤操作
- 关闭 Firefox 浏览器
- 在“运行”对话框中输入:“firefox.exe -p”,然后单击“确定”
如果上述步骤未打开配置文件窗口,请尝试以下 3 个步骤
提供 Firefox 的完整位置,例如在我的膝上“C:\Program Files (x86)\Mozilla Firefox\firefox.exe -p”
创建新的配置文件并启动它。 (例如:个人资料名称是 myProfile)
登录网络应用程序并保存任何经过身份验证的相关内容(如果有)
ProfilesIni profile = new ProfilesIni(); FirefoxProfile myprofile = profile.getProfile("myProfile"); WebDriver driver = new FirefoxDriver(myprofile);
谢谢你, 穆拉利
关于java - 自动化时出现 HTTP 401 错误,但在手动测试时工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34940059/