【问题标题】:How to automate "Authentication required" pop up in Opera 12.x with Selenium webdriver如何使用 Selenium webdriver 在 Opera 12.x 中自动弹出“需要身份验证”
【发布时间】:2014-09-24 16:14:50
【问题描述】:

我正在尝试让歌剧登录到需要用户名和密码的本地页面。我已经尝试了我知道的 2 种不同的方法

private static String URL = "http://username:password@sample.com"; //works with Firefox and Chrome

-使用机器人类,适用于 IE。

但现在我无法让 selenium 2.43.1 登录到该页面。

【问题讨论】:

  • 如果您已经有 IE 与 Robot 一起使用,您不能修改它以与 Opera 一起使用吗?

标签: selenium webdriver opera


【解决方案1】:

如果您遇到基本身份验证问题,请尝试 authenticateUsing() 方法。

警报方法authenticateUsing() 可让您绕过Http Basic Authentication 框。

WebDriverWait 等待 = new WebDriverWait(驱动程序, 10);
警报警报 = wait.until(ExpectedConditions.alertIsPresent());
alert.authenticateUsing(new UserAndPassword("USERNAME", "PASSWORD"));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-21
    • 2014-08-09
    • 1970-01-01
    • 2017-06-26
    • 1970-01-01
    • 2015-02-04
    • 2022-11-10
    相关资源
    最近更新 更多