处理 Chrome 上弹出的 Windows 身份验证 [英] Handle windows authentication pop up on Chrome

查看:56
本文介绍了处理 Chrome 上弹出的 Windows 身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 AutoIt 处理我的 Selenium webdriver 脚本的基本身份验证弹出窗口.我为 Firefox 和 Internet Explorer 编写了一个脚本,但它不适用于 Chrome.

I am trying to handle the basic authentication pop up for my Selenium webdriver scripts using AutoIt. I wrote a script for Firefox and Internet Explorer but it doesn't work for Chrome.

当我尝试使用 AutoIt 窗口信息工具识别 Chrome 上弹出的身份验证时 结果是空的.我正在使用以下 AutoIt 脚本:

When I tried identifying the authentication pop up on Chrome using AutoIt Window Information Tool it came up empty. I am using following AutoIt script:

WinWaitActive("Authentication Required","","120")
If WinExists("Authentication Required") Then
    Send("username{TAB}")
    Send("password{Enter}")
EndIf

任何使此工作正常的指针都会有所帮助.我没有使用 username@password:google.com,因为重定向时会出现一些身份验证弹出窗口.

Any pointers to get this to work would be helpful. I am not using username@password:google.com because some authentication pop ups appear on redirection.

推荐答案

我能够让 AutoIt 通过文本而不是窗口标题来定位窗口.AutoIt Window Information Tool 无法识别标题,但可以识别可见文本.

I was able to have AutoIt target the window by text, not window title. AutoIt Window Information Tool did not recognize the title but it did recognize the visible text.

所以我把脚本改成了:

WinWaitActive("","Authentication Required","120")
If WinExists("","Authentication Required") Then
    Send("username{TAB}")
    Send("password{Enter}")
EndIf

效果很好.

这篇关于处理 Chrome 上弹出的 Windows 身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆