【问题标题】:How to get control to selenium web driver browser window如何控制硒网络驱动程序浏览器窗口
【发布时间】:2016-11-25 15:12:42
【问题描述】:

我正在使用 java selenium web 驱动程序为网站开发自动化脚本。

但该网站两次请求“需要身份验证”(窗口)。

我通过修改 URL 处理了第一个“需要身份验证”窗口,如下所示

http://username:password@thaturl.com

但要处理第二个“Windows 身份验证”,我依赖于多处理。

我为处理第二个“需要身份验证”窗口做了以下操作

Whenever the browser got stucks at "Authentication required" window, then I will be 
starting a small http server and opening a url, that opened url will type the username 
and password in the "Authentication required" window ( i.e. I am triggering another 
process through a url by creating handler for that url which will copy username and 
password in the "Authentication Required" window)

但我的问题是网络驱动程序窗口没有在所有其他窗口之上,所以我无法使用机器人对象在确切位置复制用户名和密码。

提前致谢

【问题讨论】:

  • 你为什么使用机器人?没有办法引用用户/通行证字段?例如,也许这是一个 flash 或 java 小程序或 selenium 确实不支持的东西。
  • 用于执行“ctrl v”,将用户名和密码复制到框中
  • 窗口看起来像下面的链接stackoverflow.com/questions/12151958/…
  • 我可以得到任何替代来避免机器人对象吗?

标签: java selenium selenium-webdriver


【解决方案1】:

您可以使用 AutoIT 自动化窗口对话框,并且对于您的场景,您实际上也可以使特定窗口成为焦点。

这是一个reference,但有很多关于这个主题的帖子。

【讨论】:

    猜你喜欢
    • 2017-04-16
    • 2015-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-16
    • 2021-09-15
    • 1970-01-01
    相关资源
    最近更新 更多