http 登录请求 - selenium webdriver

问题描述

我遇到了与 https login request - selenium webdriver 类似的问题,但需要注意的是,我无法在 http 登录过程后登陆主页提货页面。我注意到 JSessionId 被写入了一个 cookie,但没有完全完成重定向。以下是问题的完整描述:

我试图使用 http 登录 url 登录到应用程序并执行我的操作,但由于登录过程未成功完成而无法执行此操作。

这些是我的观察。

当我点击登录 url 并登录时,它在内部引导或重定向到另一个附加了 JSESSION ID 的 url,并且没有成功完成登录过程

我尝试使用以下网址登录页面:http://abcd.xyz.com:7900/ms/index.do。预计登陆成功后登陆http://abcd.xyz.com:7900/ms/ms.do?time=。但是在这登录过程中,它通过几次重定向生成了JSESSIONID,并且无法登陆主页。

步骤:

实际登录网址如下:http://abcd.xyz.com:7900/ms/index.do

当我点击上面的网址 driver.get("https:/abcd.xyz.com:7900/ms/index.do");并尝试完成登录过程,部分完成并重定向http://abcd.xyz.com:7900/ms/login.do;jsessionid=eap1.eap

成功登录后,预计会登陆带有 url http://abcd.xyz.com:7900/ms/ms.do?time= 的主页,但从未发生过。测试以 NoSuchElementFound 结束,因为它无法成功登录

我的 ChromeDriver 选项代码如下所示: // 设置首选项 Map prefs = new HashMap(); prefs.put("credentials_enable_service",false); prefs.put("password_manager_enabled",false);

    chromeOptions.addArguments("--disable-save-password-bubble");
    chromeOptions.addArguments("disable-infobars");
    chromeOptions.setCapability(CapabilityType.ACCEPT_SSL_CERTS,true);
    chromeOptions.setCapability(CapabilityType.SUPPORTS_JAVASCRIPT,true);
    chromeOptions.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION,true);
    chromeOptions.addArguments("--disable-web-security","--ignore-certificate-errors","--allow-running-insecure-content");
    chromeOptions.setAcceptInsecureCerts(true);

任何帮助解决这个谜团的人都将不胜感激。谢谢!

我也注意到 Cypress.io 有同样的问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)