【发布时间】:2019-11-26 17:39:57
【问题描述】:
我正在尝试访问启用了 https 和 SSO 的站点。 我已经在 URL 本身中传递了用户 ID 和密码,但这不适用于 chrome 浏览器。
我观察到 url 中有一种令牌被添加到 url 之间。每次访问该 url 时,此令牌都是新的。
我认为在这里可以工作的是 .. 访问 url -> 这将在 url 中添加一个新令牌 -> 身份验证弹出窗口将出现 -> 然后我将获取当前 url(使用当前令牌)-> driver.get这个获取的 url
我已经手动尝试过了,它工作正常..
当身份验证弹出窗口仍然打开时,有人可以帮我获取当前的 url 值,因为对我来说,控件没有移动到下面代码的下一行。
public static void main(String[] args) throws InterruptedException, AWTException {
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("url_without_token");
// here authentication will come and url is updated with token
String currentURL = driver.getCurrentUrl();
System.out.println(currentURL);
driver.get(currentURL);
}
【问题讨论】:
-
已经尝试过这些方法,但它不起作用@DipakBachhav
-
您可以在这里粘贴您的网址吗?
-
对不起..我不能
标签: java selenium authentication